Documentation
¶
Index ¶
Constants ¶
View Source
const ( AtypIPv4 = 1 AtypDomainName = 3 AtypIPv6 = 4 TCP NetWork = iota UDP HTTP Type = iota HTTPCONNECT SOCKS REDIR )
Socks addr type
View Source
const Name = "clash"
Variables ¶
View Source
var ( Version = "unknown version" BuildTime = "unknown time" )
View Source
var Path *path
Path is used to get the configuration path
Functions ¶
func SetConfig ¶ added in v0.17.0
func SetConfig(file string)
SetConfig is used to set the configuration file
func SetHomeDir ¶ added in v0.8.0
func SetHomeDir(root string)
SetHomeDir is used to set the configuration path
Types ¶
type AdapterType ¶ added in v0.5.0
type AdapterType int
AdapterType is enum of adapter type
const ( Direct AdapterType = iota Fallback Reject Selector Shadowsocks Snell Socks5 Http URLTest Vmess LoadBalance )
Adapter Type
func (AdapterType) String ¶ added in v0.5.0
func (at AdapterType) String() string
type Conn ¶ added in v0.16.0
type Conn interface {
net.Conn
Connection
}
type Connection ¶ added in v0.16.0
type Connection interface {
Chains() Chain
AppendToChains(adapter ProxyAdapter)
}
type DelayHistory ¶ added in v0.13.0
type Metadata ¶ added in v0.8.0
type Metadata struct {
NetWork NetWork `json:"network"`
Type Type `json:"type"`
SrcIP net.IP `json:"sourceIP"`
DstIP net.IP `json:"destinationIP"`
SrcPort string `json:"sourcePort"`
DstPort string `json:"destinationPort"`
AddrType int `json:"-"`
Host string `json:"host"`
}
Metadata is used to store connection address
func (*Metadata) RemoteAddress ¶ added in v0.16.0
type PacketConn ¶ added in v0.16.0
type PacketConn interface {
net.PacketConn
Connection
}
type ProxyAdapter ¶
type RuleType ¶
type RuleType int
type ServerAdapter ¶
type UDPPacket ¶ added in v0.17.0
type UDPPacket interface {
// Data get the payload of UDP Packet
Data() []byte
// WriteBack writes the payload with source IP/Port equals addr
// - variable source IP/Port is important to STUN
// - if addr is not provided, WriteBack will wirte out UDP packet with SourceIP/Prot equals to origional Target,
// this is important when using Fake-IP.
WriteBack(b []byte, addr net.Addr) (n int, err error)
// Close closes the underlaying connection.
Close() error
// LocalAddr returns the source IP/Port of packet
LocalAddr() net.Addr
}
UDPPacket contains the data of UDP packet, and offers control/info of UDP packet's source
Click to show internal directories.
Click to hide internal directories.