commands

package
v0.0.0-...-ab66116 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModeGlobal = "global"
	ModeRule   = "rule"
	ModeDirect = "direct"
)
View Source
var (
	ProxyTypeSelector = "Selector"
	ProxyTypeDirect   = "Direct"
	ProxyTypeReject   = "Reject"

	ProxyNameGlobal = "GLOBAL"
)

common proxy values

View Source
var (
	ErrSelectorNotInitialized = errors.New("the selector table is not initialized")
)

Functions

func GetProxies

func GetProxies() (map[string]Proxy, error)

func HandleCommonCommand

func HandleCommonCommand(args []string)

func HandleMiscCommand

func HandleMiscCommand(args []string)

func HandleModeCommand

func HandleModeCommand(args []string)

func HandleProxyCommand

func HandleProxyCommand(args []string)

func HandleServerCommand

func HandleServerCommand(args []string)

func ProxySetResolver

func ProxySetResolver(params []string) (int, []common.Node)

func UseServerResolver

func UseServerResolver(params []string) (int, []common.Node)

Types

type Proxy

type Proxy struct {
	Name    string   `json:"name"`
	Type    string   `json:"type"`
	Now     string   `json:"now"`
	All     []string `json:"all"`
	History []struct {
		Delay int `json:"delay"`
	} `json:"history"`
}

func GetProxyGroup

func GetProxyGroup(group string) (*Proxy, error)

func (Proxy) LastestDelay

func (p Proxy) LastestDelay() int

LastestDelay returns the last delay recorded in history, 0 means the delay is unknown, should be failed to connect.

func (Proxy) NameEncoded

func (p Proxy) NameEncoded() string

type ProxyList

type ProxyList []Proxy

func (ProxyList) Len

func (l ProxyList) Len() int

func (ProxyList) Less

func (l ProxyList) Less(i, j int) bool

func (ProxyList) Swap

func (l ProxyList) Swap(i, j int)

type SelectorTable

type SelectorTable struct {
	Selector Proxy
	Proxies  []Proxy
}

func GetSelectorTable

func GetSelectorTable() (*SelectorTable, error)

func (SelectorTable) BenchMark

func (s SelectorTable) BenchMark()

func (SelectorTable) Render

func (s SelectorTable) Render() (string, error)

Render the table

func (SelectorTable) Use

func (s SelectorTable) Use(id int) error

Use proxy based on id

Jump to

Keyboard shortcuts

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