Documentation
¶
Index ¶
- type PacketHeaders
- type Proxy
- type ProxyWrapper
- func (p *ProxyWrapper) AddRelayedConn(ctx context.Context, _ *net.UDPAddr, remoteConn net.Conn) error
- func (p *ProxyWrapper) CloseConn() error
- func (p *ProxyWrapper) EndpointAddr() *net.UDPAddr
- func (p *ProxyWrapper) InjectPacket(b []byte) error
- func (p *ProxyWrapper) Pause()
- func (p *ProxyWrapper) RedirectAs(endpoint *net.UDPAddr)
- func (p *ProxyWrapper) SetDisconnectListener(disconnected func())
- func (p *ProxyWrapper) Work()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PacketHeaders ¶
type PacketHeaders struct {
// contains filtered or unexported fields
}
PacketHeaders holds pre-created headers and buffers for efficient packet sending
func NewPacketHeaders ¶
func NewPacketHeaders(localWGListenPort int, endpoint *net.UDPAddr) (*PacketHeaders, error)
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy forwards packets between relayed connections and a local kernel WireGuard instance. Every relayed peer gets its own loopback address as its WireGuard endpoint, so a single socket serves all of them: the destination address of an incoming packet identifies the peer.
func (*Proxy) AddRelayedConn ¶
AddRelayedConn assigns an endpoint address to the relayed connection and returns the address WireGuard should send to, along with the key the connection is stored under.
type ProxyWrapper ¶
type ProxyWrapper struct {
// contains filtered or unexported fields
}
ProxyWrapper help to keep the remoteConn instance for net.Conn.Close function call
func NewProxyWrapper ¶
func NewProxyWrapper(proxy *Proxy) *ProxyWrapper
func (*ProxyWrapper) AddRelayedConn ¶
func (*ProxyWrapper) CloseConn ¶
func (p *ProxyWrapper) CloseConn() error
CloseConn close the remoteConn and automatically remove the conn instance from the map
func (*ProxyWrapper) EndpointAddr ¶
func (p *ProxyWrapper) EndpointAddr() *net.UDPAddr
func (*ProxyWrapper) InjectPacket ¶
func (p *ProxyWrapper) InjectPacket(b []byte) error
InjectPacket writes b to the remote peer over the underlying transport.
func (*ProxyWrapper) Pause ¶
func (p *ProxyWrapper) Pause()
func (*ProxyWrapper) RedirectAs ¶
func (p *ProxyWrapper) RedirectAs(endpoint *net.UDPAddr)
func (*ProxyWrapper) SetDisconnectListener ¶
func (p *ProxyWrapper) SetDisconnectListener(disconnected func())
func (*ProxyWrapper) Work ¶
func (p *ProxyWrapper) Work()