mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-16 11:51:30 +01:00
bc3d647d6b
Update Pion related versions to the latest --------- Co-authored-by: Yury Gargay <yury.gargay@gmail.com>
37 lines
511 B
Go
37 lines
511 B
Go
package stdnet
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/pion/transport/v3"
|
|
)
|
|
|
|
type pionDiscover struct {
|
|
}
|
|
|
|
func (d pionDiscover) iFaces() ([]*transport.Interface, error) {
|
|
ifs := []*transport.Interface{}
|
|
|
|
oifs, err := net.Interfaces()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
for _, oif := range oifs {
|
|
ifc := transport.NewInterface(oif)
|
|
|
|
addrs, err := oif.Addrs()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
for _, addr := range addrs {
|
|
ifc.AddAddress(addr)
|
|
}
|
|
|
|
ifs = append(ifs, ifc)
|
|
}
|
|
|
|
return ifs, nil
|
|
}
|