Documentation ¶
Overview ¶
Package epdisc implements endpoint (EP) discovery using Interactive Connection Establishment (ICE).
Index ¶
- Constants
- Variables
- func CandidatePairCanBeNATted(cp *ice.CandidatePair) bool
- func NftablesUserDataGet(udata []byte, styp NftablesUserDataType) []byte
- func NftablesUserDataGetInt(udata []byte, typ NftablesUserDataType) (uint32, bool)
- func NftablesUserDataGetString(udata []byte, typ NftablesUserDataType) (string, bool)
- func NftablesUserDataPut(udata []byte, typ NftablesUserDataType, data []byte) []byte
- func NftablesUserDataPutInt(udata []byte, typ NftablesUserDataType, num uint32) []byte
- func NftablesUserDataPutString(udata []byte, typ NftablesUserDataType, str string) []byte
- type BindProxy
- func (p *BindProxy) BindClose() error
- func (p *BindProxy) Close() error
- func (p *BindProxy) ListenPort() (uint16, bool)
- func (p *BindProxy) Receive(buf []byte) (int, wgconn.Endpoint, error)
- func (p *BindProxy) Send(buf []byte, ep wgconn.Endpoint) (int, error)
- func (p *BindProxy) SetMark(_ uint32) error
- type ConnectionState
- type Interface
- func (i *Interface) Close() error
- func (i *Interface) Endpoint() (*net.UDPAddr, error)
- func (i *Interface) Marshal() *epdiscproto.Interface
- func (i *Interface) OnBindOpen(b *wg.Bind, _ uint16)
- func (i *Interface) OnInterfaceModified(_ *daemon.Interface, _ *wg.Interface, m daemon.InterfaceModifier)
- func (i *Interface) OnPeerAdded(cp *daemon.Peer)
- func (i *Interface) OnPeerModified(cp *daemon.Peer, _ *wgtypes.Peer, m daemon.PeerModifier, _, _ []net.IPNet)
- func (i *Interface) OnPeerRemoved(cp *daemon.Peer)
- func (i *Interface) PeerByPublicKey(pk crypto.Key) *Peer
- func (i *Interface) Start() error
- type KernelConnProxy
- type KernelNATProxy
- type NAT
- type NATRule
- type NftablesUserDataType
- type Peer
- func (p *Peer) Close() error
- func (p *Peer) ConnectionState() ConnectionState
- func (p *Peer) Marshal() *epdiscproto.Peer
- func (p *Peer) OnBindOpen(b *wg.Bind, _ uint16)
- func (p *Peer) OnSignalingMessage(_ *crypto.PublicKeyPair, msg *signaling.Message)
- func (p *Peer) Reachability() coreproto.ReachabilityType
- func (p *Peer) Restart() error
- func (p *Peer) Resubscribe(ctx context.Context, skOld crypto.Key) error
- type Proxy
- type ProxyConn
Constants ¶
const ( ConnectionStateNew = epdiscproto.ConnectionState_NEW ConnectionStateChecking = epdiscproto.ConnectionState_CHECKING ConnectionStateConnected = epdiscproto.ConnectionState_CONNECTED ConnectionStateCompleted = epdiscproto.ConnectionState_COMPLETED ConnectionStateFailed = epdiscproto.ConnectionState_FAILED ConnectionStateDisconnected = epdiscproto.ConnectionState_DISCONNECTED ConnectionStateClosed = epdiscproto.ConnectionState_CLOSED )
const (
StunMagicCookie uint32 = 0x2112A442
)
Variables ¶
var Get = daemon.RegisterFeature(New, 50) //nolint:gochecknoglobals
Functions ¶
func CandidatePairCanBeNATted ¶
func CandidatePairCanBeNATted(cp *ice.CandidatePair) bool
CandidatePairCanBeNATted checks if a given candidate pair can be used with kernel-space port address translation / natting.
func NftablesUserDataGet ¶
func NftablesUserDataGet(udata []byte, styp NftablesUserDataType) []byte
func NftablesUserDataGetInt ¶
func NftablesUserDataGetInt(udata []byte, typ NftablesUserDataType) (uint32, bool)
func NftablesUserDataGetString ¶
func NftablesUserDataGetString(udata []byte, typ NftablesUserDataType) (string, bool)
func NftablesUserDataPut ¶
func NftablesUserDataPut(udata []byte, typ NftablesUserDataType, data []byte) []byte
func NftablesUserDataPutInt ¶
func NftablesUserDataPutInt(udata []byte, typ NftablesUserDataType, num uint32) []byte
func NftablesUserDataPutString ¶
func NftablesUserDataPutString(udata []byte, typ NftablesUserDataType, str string) []byte
Types ¶
type BindProxy ¶
type BindProxy struct {
// contains filtered or unexported fields
}
func NewBindProxy ¶
func (*BindProxy) ListenPort ¶
type ConnectionState ¶
type ConnectionState = epdiscproto.ConnectionState
const ( ConnectionStateConnecting ConnectionState = 100 + iota ConnectionStateClosing ConnectionStateCreating ConnectionStateRestarting ConnectionStateIdle ConnectionStateGathering ConnectionStateGatheringLocal // After first remote candidate has been received ConnectionStateGatheringRemote // After first local candidate has been received )
The following connection states are an extension to the states by the ICE RFC in order to mitigate race conditions when handling the pion/ice.Agent. They are mainly used for transitioning between the states above.
type Interface ¶
type Interface struct { *daemon.Interface Peers map[*daemon.Peer]*Peer // contains filtered or unexported fields }
func (*Interface) Marshal ¶
func (i *Interface) Marshal() *epdiscproto.Interface
func (*Interface) OnInterfaceModified ¶
func (*Interface) OnPeerAdded ¶
func (*Interface) OnPeerModified ¶
func (*Interface) OnPeerRemoved ¶
type KernelConnProxy ¶
type KernelConnProxy struct { *BindProxy // contains filtered or unexported fields }
func NewKernelConnProxy ¶
func (*KernelConnProxy) Close ¶
func (p *KernelConnProxy) Close() error
Close releases all resources of the proxy
func (*KernelConnProxy) WriteKernel ¶
func (p *KernelConnProxy) WriteKernel(b []byte) (int, error)
type KernelNATProxy ¶
type KernelNATProxy struct {
// contains filtered or unexported fields
}
func NewKernelNATProxy ¶
func (*KernelNATProxy) Close ¶
func (p *KernelNATProxy) Close() error
type NAT ¶
type NAT struct {
// contains filtered or unexported fields
}
func (*NAT) MasqueradeSourcePort ¶
Perform SNAT to the source port of WireGuard UDP traffic to match port of our local ICE candidate
type NftablesUserDataType ¶
type NftablesUserDataType byte
const ( NftablesUserDataTypeComment NftablesUserDataType = iota NftablesUserDataTypeRuleID NftablesUserDataType = 100 // custom extension )
type Peer ¶
func (*Peer) ConnectionState ¶
func (p *Peer) ConnectionState() ConnectionState
func (*Peer) Marshal ¶
func (p *Peer) Marshal() *epdiscproto.Peer
Marshal marshals a description of the peer into a Protobuf description
func (*Peer) OnSignalingMessage ¶
func (p *Peer) OnSignalingMessage(_ *crypto.PublicKeyPair, msg *signaling.Message)
OnSignalingMessage is invoked for every message received via the signaling backend
func (*Peer) Reachability ¶
func (p *Peer) Reachability() coreproto.ReachabilityType