Tentative d'implémentation système d'interface -> toujours en échec

This commit is contained in:
Jérémi N ‘EndMove’ 2022-03-08 19:41:54 +01:00
parent 38a177aa51
commit a987a7eb64
Signed by: EndMove
GPG Key ID: 65C4A02E1F5371A4
2 changed files with 34 additions and 12 deletions

View File

@ -7,6 +7,7 @@ import (
"StoreBackEnd/pkg/protocol/repository"
"StoreBackEnd/pkg/protocol/rules/readers"
"StoreBackEnd/pkg/protocol/rules/writers"
"StoreBackEnd/pkg/utils"
"time"
)
@ -15,7 +16,7 @@ const (
)
func main() {
//utils.NetworkLister() // TODO REMOVE
utils.NetworkLister() // TODO REMOVE
println("StoreBackEnd started !")
// Loading App config

View File

@ -81,18 +81,39 @@ func (client ClientMulticast) ResolveAddr() (*net.UDPAddr, bool) {
}
// ResolveInterfaceAddr Resolves the network interface address.
func ResolveInterfaceAddr(inter string) (*net.UDPAddr, bool) { // TODO Work in progress ! do not touch
i, err := net.InterfaceByName(inter)
if err != nil {
println(err.Error())
return nil, true
}
addrs, _ := i.Addrs()
println("INFO ABOUT THE SELECTED INTERFACE (TEMPORAIRE)")
for a, v := range addrs {
println(a, v.(*net.IPNet).String())
}
func ResolveInterfaceAddr(inter string) (*net.UDPAddr, bool) {
//i, err := net.InterfaceByName(inter)
//addrs, err := i.Addrs()
//println(addrs[0])
//addr, err := net.ResolveUDPAddr("udp", addrs[0].String())
//if err != nil {
// println(err.Error())
// return nil, true
//}
return nil, false
//var ipv4Addr net.IP
//ief, err := net.InterfaceByName(inter)
//if err != nil {
// println(err.Error())
// return nil, true
//}
//addrs, err := ief.Addrs()
//if err != nil {
// println(err.Error())
// return nil, true
//}
//for _, addr := range addrs {
// if ipv4Addr = addr.(*net.IPNet).IP; ipv4Addr != nil {
// break
// }
//}
//println(ipv4Addr.String())
//addr, err := net.ResolveUDPAddr("udp", ipv4Addr.String())
//if err != nil {
// println(err.Error())
// return nil, true
//}
//return addr, false
}
// DialUdp Ouvre une connection UDP