You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
627 B
Go
33 lines
627 B
Go
1 year ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"git.kiefte.eu/lapingvino/infodump/message"
|
||
|
shell "github.com/ipfs/go-ipfs-api"
|
||
|
)
|
||
|
|
||
|
func TestIPFSGateway(gateway string) error {
|
||
|
// Test the IPFS gateway
|
||
|
fmt.Println("Testing IPFS gateway...")
|
||
|
ipfs := shell.NewShell(gateway)
|
||
|
_, err := ipfs.ID()
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
func SetIPFSGateway() {
|
||
|
// Set the IPFS gateway
|
||
|
fmt.Println("Enter the IPFS gateway: ")
|
||
|
var gateway string
|
||
|
fmt.Scanln(&gateway)
|
||
|
// Test the IPFS gateway
|
||
|
err := TestIPFSGateway(gateway)
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
return
|
||
|
} else {
|
||
|
fmt.Println("IPFS gateway set to: ", gateway)
|
||
|
message.IPFSGateway = gateway
|
||
|
}
|
||
|
}
|