go-waku/library/api_discovery.go

34 lines
1016 B
Go

package main
import (
"C"
mobile "github.com/waku-org/go-waku/mobile"
)
// Returns a list of multiaddress given a url to a DNS discoverable ENR tree
// The nameserver can optionally be specified to resolve the enrtree url. Otherwise NULL or
// empty to automatically use the default system dns.
// If ms is greater than 0, the subscription must happen before the timeout
// (in milliseconds) is reached, or an error will be returned
//
//export waku_dns_discovery
func waku_dns_discovery(url *C.char, nameserver *C.char, ms C.int) *C.char {
response := mobile.DnsDiscovery(C.GoString(url), C.GoString(nameserver), int(ms))
return C.CString(response)
}
// Starts DiscoveryV5 service to discover and connect to new peers
//export waku_discv5_start
func waku_discv5_start() *C.char {
response := mobile.StartDiscoveryV5()
return C.CString(response)
}
// Stops DiscoveryV5 service
//export waku_discv5_stop
func waku_discv5_stop() *C.char {
response := mobile.StopDiscoveryV5()
return C.CString(response)
}