Musique - mDNS resolution integration
This commit is contained in:
parent
95a28723fd
commit
37bc4e87b3
@ -224,7 +224,7 @@ func myAddressInTheSameNetwork(remote string) (string, error) {
|
|||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
ip, ipNet, err := net.ParseCIDR(addr.String())
|
ip, ipNet, err := net.ParseCIDR(addr.String())
|
||||||
if err == nil && ipNet.Contains(remoteIP) {
|
if err == nil && ipNet.Contains(remoteIP) {
|
||||||
return ip.String(), nil
|
return fmt.Sprintf("%s:%d", ip, port), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,12 @@ func ServerInit(inputNick string, inputPort int) {
|
|||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = registerDNS()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln("Failed to register DNS:", err)
|
||||||
|
}
|
||||||
|
// defer server.Shutdown()
|
||||||
|
|
||||||
if err := registerRemotes(initialWaitingTime); err != nil {
|
if err := registerRemotes(initialWaitingTime); err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
@ -55,12 +61,10 @@ func ServerBeginProtocol() {
|
|||||||
|
|
||||||
//export Discover
|
//export Discover
|
||||||
func Discover() {
|
func Discover() {
|
||||||
if len(remotes) == 0 {
|
if err := registerRemotes(userRequestedWatingingTime); err != nil {
|
||||||
if err := registerRemotes(userRequestedWatingingTime); err != nil {
|
log.Println("discover:", err)
|
||||||
log.Println("discover:", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
synchronizeHostsWithRemotes()
|
// synchronizeHostsWithRemotes()
|
||||||
}
|
}
|
||||||
|
|
||||||
//export ListKnownRemotes
|
//export ListKnownRemotes
|
||||||
|
Loading…
Reference in New Issue
Block a user