Sfoglia il codice sorgente

Bind to IPv6 multicast group instead of ::

This makes it possible to run multiple instances on the same box, all
receiving local discovery packets. Tested on Mac, Windows, supposed to
work on at least Linux too. For Windows, there may be issues with XP and
earlier, but meh...
Jakob Borg 10 anni fa
parent
commit
cae120fd4d
1 ha cambiato i file con 1 aggiunte e 2 eliminazioni
  1. 1 2
      lib/beacon/multicast.go

+ 1 - 2
lib/beacon/multicast.go

@@ -8,7 +8,6 @@ package beacon
 
 
 import (
 import (
 	"errors"
 	"errors"
-	"fmt"
 	"net"
 	"net"
 
 
 	"golang.org/x/net/ipv6"
 	"golang.org/x/net/ipv6"
@@ -28,7 +27,7 @@ func NewMulticast(addr string) (*Multicast, error) {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	conn, err := net.ListenPacket("udp6", fmt.Sprintf("[::]:%d", gaddr.Port))
+	conn, err := net.ListenPacket("udp6", addr)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}