Documentation
¶
Overview ¶
Package stdnet is an extension of the pion's stdnet. With it the list of the interface can come from external source. More info: https://github.com/golang/go/issues/40569
Index ¶
- func InterfaceFilter(disallowList []string, detector *WGDetector) func(string) bool
- type ExternalIFaceDiscover
- type Net
- func (n *Net) Dial(network, address string) (net.Conn, error)
- func (n *Net) DialTCP(network string, laddr, raddr *net.TCPAddr) (transport.TCPConn, error)
- func (n *Net) DialUDP(network string, laddr, raddr *net.UDPAddr) (transport.UDPConn, error)
- func (n *Net) InterfaceByIndex(index int) (*transport.Interface, error)
- func (n *Net) InterfaceByName(name string) (*transport.Interface, error)
- func (n *Net) Interfaces() ([]*transport.Interface, error)
- func (n *Net) ListenPacket(network, address string) (net.PacketConn, error)
- func (n *Net) ListenUDP(network string, locAddr *net.UDPAddr) (transport.UDPConn, error)
- func (n *Net) ResolveTCPAddr(network, address string) (*net.TCPAddr, error)
- func (n *Net) ResolveUDPAddr(network, address string) (*net.UDPAddr, error)
- type WGDetector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InterfaceFilter ¶ added in v0.16.0
func InterfaceFilter(disallowList []string, detector *WGDetector) func(string) bool
InterfaceFilter is a function passed to ICE Agent to filter out not allowed interfaces to avoid building tunnel over them. A nil detector probes the interface on every call, which is what the callers that build one filter for their whole lifetime want.
Types ¶
type ExternalIFaceDiscover ¶ added in v0.16.0
type ExternalIFaceDiscover interface {
// IFaces return with the description of the interfaces
IFaces() (string, error)
}
ExternalIFaceDiscover provide an option for external services (mobile) to collect network interface information
type Net ¶
Net is an implementation of the net.Net interface based on functions of the standard net package.
func NewNet ¶
func NewNet(ctx context.Context, disallowList []string, detector *WGDetector) *Net
NewNet creates a new StdNet instance.
func NewNetWithDiscover ¶ added in v0.16.0
func NewNetWithDiscover(ctx context.Context, iFaceDiscover ExternalIFaceDiscover, disallowList []string, detector *WGDetector) *Net
NewNetWithDiscover creates a new StdNet instance.
func (*Net) InterfaceByIndex ¶
InterfaceByIndex returns the interface specified by index.
On Solaris, it returns one of the logical network interfaces sharing the logical data link; for more precision use InterfaceByName.
func (*Net) InterfaceByName ¶
InterfaceByName returns the interface specified by name.
func (*Net) Interfaces ¶
Interfaces returns a slice of interfaces which are available on the system
func (*Net) ListenPacket ¶ added in v0.26.4
func (n *Net) ListenPacket(network, address string) (net.PacketConn, error)
ListenPacket listens for incoming packets on the given network and address.
func (*Net) ResolveTCPAddr ¶ added in v0.59.13
ResolveTCPAddr resolves TCP addresses with context support and timeout.
type WGDetector ¶ added in v0.81.0
type WGDetector struct {
// contains filtered or unexported fields
}
WGDetector answers whether an interface is a WireGuard device, remembering the answer for a short while.
The question is asked once per interface for every ICE agent, and an agent is created per peer connection attempt, so on a large network the uncached form runs constantly. Answering it means opening a wgctrl client, which builds both a kernel and a userspace client and resolves the netlink family, and then a round trip that usually just reports the device does not exist.
A detector is safe for concurrent use and is meant to be shared by every agent.
func NewWGDetector ¶ added in v0.81.0
func NewWGDetector(ownIface string) *WGDetector
NewWGDetector returns a detector with the default time to live.
func (*WGDetector) IsWireGuard ¶ added in v0.81.0
func (d *WGDetector) IsWireGuard(iFace string) bool
IsWireGuard reports whether the named interface is a WireGuard device. An interface it cannot ask about is reported as not being one, which leaves it available to ICE exactly as an uncached probe would.