Tentative d'implémentation système d'interface -> toujours en échec
This commit is contained in:
parent
38a177aa51
commit
a987a7eb64
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user