constant

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2018 License: MIT Imports: 12 Imported by: 273

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
}

type RuleType

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

Rule Type

type ServerAdapter

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

type Traffic added in v0.4.0

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

func NewTraffic added in v0.4.0

func NewTraffic(interval time.Duration) *Traffic

func (*Traffic) Down added in v0.4.0

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

func (*Traffic) Now added in v0.4.0

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

func (*Traffic) Up added in v0.4.0

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

Jump to

Keyboard shortcuts

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