42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
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 := 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)
|
|
observation := proof.BuildProof(result, location)
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|