constant

package
v0.0.0-...-0269b34 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AtypIPv4       = 1
	AtypDomainName = 3
	AtypIPv6       = 4

	TCP = iota
	UDP
)

Socks addr type

View Source
const (
	Name             = "clash"
	DefalutHTTPPort  = "7890"
	DefalutSOCKSPort = "7891"
)

Variables

View Source
var (
	HomeDir    string
	ConfigPath string
	MMDBPath   string
)

Functions

func GetConfig

func GetConfig() (*ini.File, error)

Types

type Addr

type Addr struct {
	NetWork  NetWork
	AddrType int
	Host     string
	IP       *net.IP
	Port     string
}

Addr is used to store connection address

func (*Addr) String

func (addr *Addr) String() string

type NetWork

type NetWork int

func (*NetWork) String

func (n *NetWork) String() string

type Proxy

type Proxy interface {
	Name() string
	Generator(addr *Addr) (ProxyAdapter, error)
}

type ProxyAdapter

type ProxyAdapter interface {
	ReadWriter() io.ReadWriter
	Conn() net.Conn
	Close()
}

type Rule

type Rule interface {
	RuleType() RuleType
	IsMatch(addr *Addr) bool
	Adapter() string
	Payload() string
}

type RuleType

type RuleType int
const (
	DomainSuffix RuleType = iota
	DomainKeyword
	GEOIP
	IPCIDR
	FINAL
)

Rule Type

func (RuleType) String

func (rt RuleType) String() string

type ServerAdapter

type ServerAdapter interface {
	Addr() *Addr
	Connect(ProxyAdapter)
	Close()
}

type Traffic

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

func NewTraffic

func NewTraffic(interval time.Duration) *Traffic

func (*Traffic) Down

func (t *Traffic) Down() chan<- int64

func (*Traffic) Now

func (t *Traffic) Now() (up int64, down int64)

func (*Traffic) Up

func (t *Traffic) Up() chan<- int64

Jump to

Keyboard shortcuts

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