v1.0.1 probe

This commit is contained in:
2025-04-29 23:40:33 +02:00
parent 371b44422b
commit 56c57957c8
4 changed files with 152 additions and 42 deletions
+25 -4
View File
@@ -1,20 +1,41 @@
package main
import (
"flag"
"fmt"
"os"
"git.cryptolab.re/foudre/whitepaper_obsero/pkg/geo"
"git.cryptolab.re/foudre/whitepaper_obsero/pkg/probe"
"git.cryptolab.re/foudre/whitepaper_obsero/pkg/proof"
)
func main() {
target := "https://example.com"
target := flag.String("target", "https://example.com", "Target URL to probe")
output := flag.String("output", "proof_http_signed.json", "Output file name for proof JSON")
useIPFS := flag.Bool("ipfs", false, "Upload to IPFS after proof generation")
flag.Parse()
location := geo.GetGeoLocation()
result := probe.HttpPing(target)
result := probe.HttpPing(*target)
observation := proof.BuildProof(result, location)
proof.SaveProof(observation, "proof_http_result.json")
fmt.Println("✅ Proof generated and saved.")
err := proof.SignProof(&observation)
if err != nil {
fmt.Println("❌ Failed to sign proof:", err)
os.Exit(1)
}
proof.SaveProof(observation, *output)
fmt.Println("✅ Signed proof saved to", *output)
if *useIPFS {
cid, err := proof.UploadToIPFS(*output)
if err != nil {
fmt.Println("❌ Failed to upload to IPFS:", err)
} else {
fmt.Println("📡 Uploaded to IPFS with CID:", cid)
}
}
}