statistic

package
v0.3.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BYPASS_DATA []byte

go:embed statics/bypass.gz

View Source
var Mode = map[string]*MODE{
	"direct": &DIRECT,

	"block": &BLOCK,
}

Functions

func WithProxy

func WithProxy(p proxy.Proxy) func(*Shunt)

Types

type MODE

type MODE string
var (
	OTHERS MODE = "OTHERS"
	BLOCK  MODE = "BLOCK"
	DIRECT MODE = "DIRECT"
	PROXY  MODE = "PROXY"
	MAX    MODE = "MAX"

	UNKNOWN MODE = "UNKNOWN"
)

func (MODE) String

func (m MODE) String() string

type Shunt

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

func NewShunt

func NewShunt(conf config.ConfigObserver, opts ...func(*Shunt)) *Shunt

NewShunt file: bypass file; lookup: domain resolver, can be nil

func (*Shunt) Get

func (s *Shunt) Get(domain string) MODE

func (*Shunt) Refresh

func (s *Shunt) Refresh() error

type Statistic

type Statistic struct {
	statistic.UnimplementedConnectionsServer
	// contains filtered or unexported fields
}

func NewStatistic

func NewStatistic(conf config.ConfigObserver, dialer proxy.Proxy) *Statistic

func (*Statistic) AddClient

func (c *Statistic) AddClient(f func(*statistic.RateResp) error) (id int64)

func (*Statistic) AddDownload

func (c *Statistic) AddDownload(n uint64)

func (*Statistic) AddUpload

func (c *Statistic) AddUpload(n uint64)

func (*Statistic) CloseConn

func (*Statistic) Conn

func (c *Statistic) Conn(host string) (net.Conn, error)

func (*Statistic) Conns

func (*Statistic) PacketConn

func (c *Statistic) PacketConn(host string) (net.PacketConn, error)

func (*Statistic) RemoveClient

func (c *Statistic) RemoveClient(id int64)

func (*Statistic) Statistic

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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