protocol

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthMethod         protocol.ID = basePath + "/auth/"
	GetStatusMethod    protocol.ID = basePath + "/status/"
	TunnelPacketMethod protocol.ID = basePath + "/tunnel/"
	Socks5PacketMethod protocol.ID = basePath + "/socks5/"
	Socks5NoAuthMethod protocol.ID = basePath + "/socks5-noauth/"
)

Variables

This section is empty.

Functions

func AppendPacketToBuf added in v0.15.0

func AppendPacketToBuf(buf, packet []byte, dir vpn.GatewayDir) []byte

AppendPacketToBuf appends a length-prefixed tunnel packet to buf. The high bits of the length prefix encode dir; see ReadPacketHeader.

func ReadPacketHeader added in v0.18.0

func ReadPacketHeader(stream io.Reader) (size uint64, dir vpn.GatewayDir, err error)

ReadPacketHeader reads an 8-byte tunnel packet header from the stream and returns the body size and the gateway direction encoded in the high bits. Both direction bits set is rejected as a protocol error.

func SendAuth

func SendAuth(stream io.Writer, authPeer AuthPeer) error

func SendAuthResponse

func SendAuthResponse(stream io.Writer, response AuthPeerResponse) error

func SendStatus

func SendStatus(stream io.Writer, statusInfo PeerStatusInfo) error

Types

type AuthPeer

type AuthPeer struct {
	Name string
}

func ReceiveAuth

func ReceiveAuth(stream io.Reader) (AuthPeer, error)

type AuthPeerResponse

type AuthPeerResponse struct {
	Confirmed bool
	Declined  bool
}

func ReceiveAuthResponse

func ReceiveAuthResponse(stream io.Reader) (AuthPeerResponse, error)

type PeerStatusInfo

type PeerStatusInfo struct {
	Name                 string
	Declined             bool
	AllowUsingAsExitNode bool
	// VPNGatewayServerEnabled mirrors VPNGatewayConfig.ServerEnabled on the
	// sender. The receiver stores it in KnownPeer.RemoteVPNGatewayServerEnabled
	// and uses KnownPeer.CanUseAsVPNGateway() to decide whether the
	// peer is a valid VPN gateway target.
	VPNGatewayServerEnabled bool
}

func ReceiveStatus

func ReceiveStatus(stream io.Reader) (PeerStatusInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL