Skip to content

Commit

Permalink
added cflags
Browse files Browse the repository at this point in the history
  • Loading branch information
randomlogin committed Sep 3, 2024
1 parent ee7f483 commit efb0b44
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
3 changes: 3 additions & 0 deletions prove/getdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package prove
/*
#include <getdns/getdns.h>
#include "getdns_dnssec.h"
#cgo LDFLAGS: -lgetdns
#cgo LDFLAGS: "-L/usr/local/lib"
#cgo CFLAGS: "-I/usr/local/include/getdns"
*/
import "C"
import (
Expand Down
16 changes: 3 additions & 13 deletions sync/hnsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

var (
Version = "0.0.14"
Version = "0.0.16"
)

const (
Expand Down

0 comments on commit efb0b44

Please sign in to comment.