proto

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdAuth = iota
	CmdHeartbeat
	CmdData
)

Variables

This section is empty.

Functions

func ReadJSON

func ReadJSON(conn net.Conn, obj interface{}) error

func Write

func Write(conn net.Conn, cmd int, body []byte) error

func WriteJSON

func WriteJSON(conn net.Conn, cmd int, obj interface{}) error

Types

type C2SAuth

type C2SAuth struct {
	Key     string        `json:"key"`
	Domain  string        `json:"domain"`
	Forward []ForwardItem `json:"forwards"`
}

type C2SHeartbeat

type C2SHeartbeat struct{}

type ForwardItem

type ForwardItem struct {
	// forward protocol. eg: tcp, udp, https, http
	Protocol string `json:"protocol"`

	// forward ports
	// key is the port opennotrd listen
	// value is local port
	Ports map[int]string `json:"ports"`

	// local ip, default is 127.0.0.1
	// the traffic will be forward to $LocalIP:$LocalPort
	// for example: 127.0.0.1:8080. 192.168.31.65:8080
	LocalIP string `json:"localIP"`

	// raw config pass to server
	RawConfig string `json:"rawConfig"`
}
type Header [4]byte

1字节版本 1字节命令 2字节长度

func Read

func Read(conn net.Conn) (Header, []byte, error)

func (Header) Bodylen

func (h Header) Bodylen() int

func (Header) Cmd

func (h Header) Cmd() int

func (Header) Version

func (h Header) Version() int

type ProxyProtocol added in v1.0.3

type ProxyProtocol struct {
	Protocol string `json:"protocol"`
	SrcIP    string `json:"sip"`
	SrcPort  string `json:"sport"`
	DstIP    string `json:"dip"`
	DstPort  string `json:"dport"`
}

type S2CAuth

type S2CAuth struct {
	Domain string `json:"domain"` // 分配域名
	Vip    string `json:"vip"`    // 分配虚拟ip地址
}

type S2CHeartbeat

type S2CHeartbeat struct {
}

Jump to

Keyboard shortcuts

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