Documentation
¶
Index ¶
- Variables
- func EndpointToUDPAddr(e Endpoint) *net.UDPAddr
- type ActivityRecorder
- type Endpoint
- type ICEBind
- func (s *ICEBind) ActivityRecorder() *ActivityRecorder
- func (s *ICEBind) Close() error
- func (s *ICEBind) GetICEMux() (*udpmux.UniversalUDPMuxDefault, error)
- func (s *ICEBind) Open(uport uint16) ([]wgConn.ReceiveFunc, uint16, error)
- func (b *ICEBind) ReceiveFromEndpoint(ctx context.Context, ep *Endpoint, buf []byte)
- func (b *ICEBind) RemoveEndpoint(fakeIP netip.Addr)
- func (b *ICEBind) Send(bufs [][]byte, ep wgConn.Endpoint) error
- func (b *ICEBind) SetEndpoint(fakeIP netip.Addr, conn net.Conn)
- type PeerRecord
- type RelayBindJS
- func (s *RelayBindJS) ActivityRecorder() *ActivityRecorder
- func (s *RelayBindJS) Close() error
- func (s *RelayBindJS) GetICEMux() (*udpmux.UniversalUDPMuxDefault, error)
- func (s *RelayBindJS) Open(uport uint16) ([]conn.ReceiveFunc, uint16, error)
- func (s *RelayBindJS) ReceiveFromEndpoint(ctx context.Context, ep *Endpoint, buf []byte)
- func (s *RelayBindJS) RemoveEndpoint(fakeIP netip.Addr)
- func (s *RelayBindJS) Send(bufs [][]byte, ep conn.Endpoint) error
- func (b *RelayBindJS) SetEndpoint(fakeIP netip.Addr, conn net.Conn)
Constants ¶
This section is empty.
Variables ¶
var (
ErrUDPMUXNotSupported = fmt.Errorf("UDPMUX is not supported in WASM")
)
Functions ¶
func EndpointToUDPAddr ¶
Types ¶
type ActivityRecorder ¶
type ActivityRecorder struct {
// contains filtered or unexported fields
}
func NewActivityRecorder ¶
func NewActivityRecorder() *ActivityRecorder
func (*ActivityRecorder) GetLastActivities ¶
func (r *ActivityRecorder) GetLastActivities() map[string]monotime.Time
GetLastActivities returns a snapshot of peer last activity
func (*ActivityRecorder) Remove ¶
func (r *ActivityRecorder) Remove(publicKey string)
func (*ActivityRecorder) UpsertAddress ¶
func (r *ActivityRecorder) UpsertAddress(publicKey string, address netip.AddrPort)
UpsertAddress adds or updates the address for a publicKey
type Endpoint ¶
type Endpoint = wgConn.StdNetEndpoint
type ICEBind ¶
type ICEBind struct {
*wgConn.StdNetBind
// contains filtered or unexported fields
}
ICEBind is a bind implementation with two main features: 1. filter out STUN messages and handle them 2. forward the received packets to the WireGuard interface from the relayed connection
ICEBind.endpoints var is a map that stores the connection for each relayed peer. Fake address is just an IP address without port, in the format of 127.1.x.x where x.x is the last two octets of the peer address. We try to avoid to use the port because in the Send function the wgConn.Endpoint the port info is not exported.
func NewICEBind ¶
func (*ICEBind) ActivityRecorder ¶
func (s *ICEBind) ActivityRecorder() *ActivityRecorder
func (*ICEBind) GetICEMux ¶
func (s *ICEBind) GetICEMux() (*udpmux.UniversalUDPMuxDefault, error)
GetICEMux returns the ICE UDPMux that was created and used by ICEBind
func (*ICEBind) ReceiveFromEndpoint ¶
func (*ICEBind) RemoveEndpoint ¶
type PeerRecord ¶
type RelayBindJS ¶
type RelayBindJS struct {
*conn.StdNetBind
// contains filtered or unexported fields
}
RelayBindJS is a conn.Bind implementation for WebAssembly environments. Do not limit to build only js, because we want to be able to run tests
func NewRelayBindJS ¶
func NewRelayBindJS() *RelayBindJS
func (*RelayBindJS) ActivityRecorder ¶
func (s *RelayBindJS) ActivityRecorder() *ActivityRecorder
func (*RelayBindJS) Close ¶
func (s *RelayBindJS) Close() error
func (*RelayBindJS) GetICEMux ¶
func (s *RelayBindJS) GetICEMux() (*udpmux.UniversalUDPMuxDefault, error)
GetICEMux returns the ICE UDPMux that was created and used by ICEBind
func (*RelayBindJS) Open ¶
func (s *RelayBindJS) Open(uport uint16) ([]conn.ReceiveFunc, uint16, error)
Open creates a receive function for handling relay packets in WASM.
func (*RelayBindJS) ReceiveFromEndpoint ¶
func (s *RelayBindJS) ReceiveFromEndpoint(ctx context.Context, ep *Endpoint, buf []byte)
func (*RelayBindJS) RemoveEndpoint ¶
func (s *RelayBindJS) RemoveEndpoint(fakeIP netip.Addr)
func (*RelayBindJS) Send ¶
func (s *RelayBindJS) Send(bufs [][]byte, ep conn.Endpoint) error
Send forwards packets through the relay connection for WASM.
func (*RelayBindJS) SetEndpoint ¶
func (b *RelayBindJS) SetEndpoint(fakeIP netip.Addr, conn net.Conn)