diff --git a/go.mod b/go.mod index 4290d3b..0a7b242 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/miekg/unbound v0.0.0-20180419064740-e2b53b2dbcba github.com/nodech/go-hsd-utils v0.0.1 golang.org/x/crypto v0.16.0 + golang.org/x/sys v0.22.0 ) require ( github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.15.0 // indirect ) diff --git a/go.sum b/go.sum index 869bc8d..4ad7cfd 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/prove/getdns.go b/prove/getdns.go index d48ab4e..1ba64e9 100644 --- a/prove/getdns.go +++ b/prove/getdns.go @@ -3,6 +3,9 @@ package prove /* #include #include "getdns_dnssec.h" +#cgo LDFLAGS: -lgetdns +#cgo LDFLAGS: "-L/usr/local/lib" +#cgo CFLAGS: "-I/usr/local/include/getdns" */ import "C" import ( diff --git a/sync/hnsd.go b/sync/hnsd.go index be6a6aa..27f7c85 100644 --- a/sync/hnsd.go +++ b/sync/hnsd.go @@ -70,24 +70,20 @@ func CheckHNSDVersion() error { } // checks if hnsd has synced all blocks in order to kill the subprocess -// does it by invoking hesoid DNS request which +// does it by invoking hesiod DNS request which // TODO export params func checkIfSynced() (bool, error) { msg := new(dns.Msg) msg.SetQuestion(dns.Fqdn(qname), dns.StringToType[qtype]) msg.SetEdns0(4096, true) - msg.Question[0].Qclass = dns.StringToClass[qclass] - // Use the net package to send the DNS query with a timeout client := new(dns.Client) - // client.Timeout = dnsTimeout response, _, err := client.Exchange(msg, dnsAddress) if err != nil { return false, fmt.Errorf("DNS query failed: %v", err) } - // Check the DNS response for synchronization status if len(response.Answer) > 0 { if txtRecord, ok := response.Answer[0].(*dns.TXT); ok { if txtRecord.Txt[0] == "true" { @@ -101,13 +97,6 @@ func checkIfSynced() (bool, error) { return false, nil } -func PeriodicallySync(interval time.Duration, pathToExecutable, confPath, pathToCheckpoint string) { - for { - GetRoots(pathToExecutable, confPath, pathToCheckpoint) - time.Sleep(interval) - } -} - func GetRoots(pathToExecutable string, confPath string, pathToCheckpoint string) { if pathToCheckpoint == "" { home, _ := os.UserHomeDir() //above already fails if it doesn't exist @@ -170,7 +159,8 @@ func GetRoots(pathToExecutable string, confPath string, pathToCheckpoint string) } if cmd.Process != nil && isSynced { - if err := cmd.Process.Signal(syscall.SIGINT); err != nil { + // if err := cmd.Process.Signal(syscall.SIGINT); err != nil { + if err := cmd.Process.Kill(); err != nil { log.Fatal("Error killing hnsd: ", err) } diff --git a/tunnel.go b/tunnel.go index f13d457..52652fb 100644 --- a/tunnel.go +++ b/tunnel.go @@ -21,7 +21,7 @@ import ( ) var ( - Version = "0.0.14" + Version = "0.0.16" ) const (