From 751fb5ef1ac0237722f5f0fe284afe3b87e2ad3d Mon Sep 17 00:00:00 2001 From: EndMove Date: Sat, 12 Mar 2022 20:36:12 +0100 Subject: [PATCH] =?UTF-8?q?Suppression=20-=20syst=C3=A8me=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/network/ClientMulticast.go | 5 ++--- pkg/utils/Network.go | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/network/ClientMulticast.go b/pkg/network/ClientMulticast.go index 12dd29d..89b1d9c 100644 --- a/pkg/network/ClientMulticast.go +++ b/pkg/network/ClientMulticast.go @@ -50,7 +50,6 @@ func (client ClientMulticast) Run() { if failedRIA { return } - println("Interface ", lAddr.IP.String()) // Init UDP server flux con, failedDU := client.DialUdp(lAddr, rAddr) @@ -87,7 +86,7 @@ func ResolveInterfaceAddr(inter string) (*net.UDPAddr, bool) { //for _, addr := range addrs { // if utils.IsIPv4(addr.String()) { // println("Selected IP", addr.String()) - // lAddr, _ := net.ResolveUDPAddr("udp", "192.168.86.25:15502") + // lAddr, _ := net.ResolveUDPAddr("udp", "127.0.0.1:15502") // return lAddr, false // } //} @@ -96,7 +95,7 @@ func ResolveInterfaceAddr(inter string) (*net.UDPAddr, bool) { // DialUdp Ouvre une connection UDP func (client ClientMulticast) DialUdp(lAddr *net.UDPAddr, rAddr *net.UDPAddr) (*net.UDPConn, bool) { - con, errDial := net.DialUDP("udp", lAddr, rAddr) + con, errDial := net.DialUDP("udp", nil, rAddr) if errDial != nil { println(errDial.Error()) return nil, true diff --git a/pkg/utils/Network.go b/pkg/utils/Network.go index c860368..607d42c 100644 --- a/pkg/utils/Network.go +++ b/pkg/utils/Network.go @@ -21,6 +21,10 @@ func NetworkLister() { println("\n\nNetwork interface list :") for i, val := range inter { fmt.Printf("%d. %s\n", i, val.Name) + addrs, _ := val.Addrs() + for _, addr := range addrs { + println("-- ", addr.String()) + } } print("\n") }