constant

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ATypeIPv4       = 1
	ATypeDomainName = 3
	ATypeIPv6       = 4
)

SOCKS address types as defined in RFC 1928 section 5.

View Source
const (
	Direct = iota
	Proxy
	Block
)
View Source
const Unknown = 999

Variables

This section is empty.

Functions

This section is empty.

Types

type IP

type IP struct {
	Addr string `json:"Addr"`
	Port int64  `json:"Port"`
}

func UnmarshalIP

func UnmarshalIP(s string) (*IP, error)

func (IP) MarshalJSON

func (i IP) MarshalJSON() ([]byte, error)

func (IP) String

func (i IP) String() string

type Metadata

type Metadata struct {
	ID      uuid.UUID `json:"-"`
	NetWork NetWork   `json:"Network"`
	Type    Type      `json:"Type"`
	Client  *IP       `json:"Client"`
	Source  *IP       `json:"Source"`
	Target  *IP       `json:"Target"`
}

func UnmarshalMetadata

func UnmarshalMetadata(s string) (*Metadata, error)

func (*Metadata) String

func (m *Metadata) String() string

type NetWork

type NetWork int
const (
	TCP NetWork = iota
	UDP
)

Socks addr type

func UnmarshalNetWork

func UnmarshalNetWork(s string) NetWork

func (NetWork) MarshalJSON

func (n NetWork) MarshalJSON() ([]byte, error)

func (NetWork) String

func (n NetWork) String() string

type Server

type Server struct {
	// 通用配置
	Host    string        `yaml:""` // 地址
	Port    int64         `yaml:""` // 端口
	Token   string        `yaml:""` // 加密key
	TLS     *TLS          `yaml:""` // 证书
	Timeout time.Duration `yaml:""` // 连接超时时间

	// 出口特殊配置
	Interface   string `yaml:""` // 指定出口网卡
	RoutingMark int    `yaml:""` // linux 下可指定fwmark

	// 证书
	TLSConf *tls.Config
}

func (*Server) Enable

func (s *Server) Enable() bool

func (*Server) LoadTLS

func (s *Server) LoadTLS()

type TCPContext

type TCPContext struct {
	SrcConn  net.Conn
	Metadata *Metadata
	Line     string // http proxy
	PreFn    func()
	PostFn   func()
}

TCPContext is used to store connection address

type TLS

type TLS struct {
	Enable      bool   `yaml:""`
	ServerName  string `yaml:""`
	Key         string `yaml:""`
	Cert        string `yaml:""`
	Fingerprint string `yaml:""`
}

type Type

type Type int
const (
	HTTP Type = iota
	HTTPS
	SOCKS4
	SOCKS5
)

func UnmarshalType

func UnmarshalType(s string) Type

func (Type) MarshalJSON

func (t Type) MarshalJSON() ([]byte, error)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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