proxy

package
v0.0.0-...-445c181 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HANDSHAKE_SYN = 0xff
	HANDSHAKE_ACK = 0x145
	HANDSHAKE_FIN = 0x194
)
View Source
const BUFFER_SIZE = 4 * 1024 * 1024

Variables

View Source
var ErrInvalidHandshakePacket = errors.New("invalid handshake packet")

Functions

func HandleGetPlayerTokenReq

func HandleGetPlayerTokenReq(conn *KCPConn, data []byte, bypass bool) ([]byte, error)

func HandleGetPlayerTokenRsp

func HandleGetPlayerTokenRsp(conn *KCPConn, data []byte, bypass bool) ([]byte, error)

func HandlePlayerLoginReq

func HandlePlayerLoginReq(conn *KCPConn, data []byte, bypass bool) ([]byte, error)

func IsHandshakePacket

func IsHandshakePacket(data []byte) bool

fast check if handshake packet

func ToLID

func ToLID(conv, token uint32) uint64

Types

type BypassSocket

type BypassSocket struct {
	// contains filtered or unexported fields
}

func (*BypassSocket) Start

func (b *BypassSocket) Start()

func (*BypassSocket) Stop

func (b *BypassSocket) Stop()

type Handler

type Handler = func(*KCPConn, []byte, bool) ([]byte, error)

type Handshake

type Handshake struct {
	// contains filtered or unexported fields
}

func NewHandshakePacket

func NewHandshakePacket(m1, conv, token, enet, m2 uint32) *Handshake

func ParseHandshakePacket

func ParseHandshakePacket(data []byte) (*Handshake, error)

func (*Handshake) Compose

func (h *Handshake) Compose() []byte

type KCPConn

type KCPConn struct {
	// contains filtered or unexported fields
}

func ConstructBypassConn

func ConstructBypassConn(hs *Handshake, key *utils.PacketKey, keyID int) (*KCPConn, error)

func ConstructKCPConn

func ConstructKCPConn(remote *net.UDPAddr, writeLocal WriteFunc, hs *Handshake, key *utils.PacketKey, keyID int) (*KCPConn, error)

func (*KCPConn) Close

func (c *KCPConn) Close(hs *Handshake)

func (*KCPConn) Input

func (c *KCPConn) Input(data []byte, size int) int

func (*KCPConn) InputServer

func (c *KCPConn) InputServer(data []byte, size int) int

func (*KCPConn) Start

func (c *KCPConn) Start()

func (*KCPConn) StartBypass

func (c *KCPConn) StartBypass()

type KCPSocket

type KCPSocket struct {
	// contains filtered or unexported fields
}

func (*KCPSocket) Start

func (k *KCPSocket) Start()

func (*KCPSocket) Stop

func (s *KCPSocket) Stop()

type ProxyInterface

type ProxyInterface interface {
	Start()
	Stop()
}

func NewBypassSocket

func NewBypassSocket(remote *net.UDPAddr, dispatchKey *utils.PacketKey, keyID int) ProxyInterface

func NewKCPSocket

func NewKCPSocket(local *net.UDPConn, remote *net.UDPAddr, dispatchKey *utils.PacketKey, keyID int) ProxyInterface

type WriteFunc

type WriteFunc = func([]byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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