core

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AUTO_SELECT_PROXY_NAME = "自动选择"
	FALLBACK_PROXY_NAME    = "故障转移"
)

Variables

View Source
var (
	ErrNotAdmin = errors.New("please run as admin or root, do not use sudo")
)
View Source
var (
	ErrNotLinux = errors.New("only support linux currently")
)
View Source
var (
	ErrNotRunning = fmt.Errorf("cyber core is not running")
)

Functions

func BenchmarkNode

func BenchmarkNode() error

func ChangeMode

func ChangeMode(mode string) error

func ChangeNode

func ChangeNode(nodeName string) error

func DisableService added in v1.0.4

func DisableService() error

func DisableTun added in v1.0.3

func DisableTun() error

func Download

func Download() error

func EditNodeConfigWithVi added in v1.0.4

func EditNodeConfigWithVi() error

func EnableService added in v1.0.4

func EnableService() error

func EnableTun added in v1.0.3

func EnableTun() error

func GetProxyPort

func GetProxyPort() (int, int, error)

func InstallService added in v1.0.4

func InstallService() error

func IsCoreInstalled added in v1.0.4

func IsCoreInstalled() (bool, error)

func IsNotRunning added in v1.0.3

func IsNotRunning(err error) bool

func IsServiceInstalled added in v1.0.4

func IsServiceInstalled() (bool, error)

func IsTunEnabled added in v1.0.3

func IsTunEnabled() (bool, error)

func ListNodes

func ListNodes() error

func ModifyAPISecret added in v1.0.4

func ModifyAPISecret(on bool, secret string) error

func Purge added in v1.0.4

func Purge() error

func Restart added in v1.0.3

func Restart() (int, error)

func ShowLog added in v1.0.3

func ShowLog() error

func ShowLogFollow added in v1.0.3

func ShowLogFollow() error

func Start

func Start() (int, error)

func Status

func Status() (int, error)

Status returns the pid of cyber core process if it is running, otherwise returns 0.

func Stop

func Stop() error

func UninstallService added in v1.0.4

func UninstallService() error

Types

type ConfigRestfulResponse

type ConfigRestfulResponse struct {
	Port           int           `json:"port"`
	SocksPort      int           `json:"socks-port"`
	RedirPort      int           `json:"redir-port"`
	TproxyPort     int           `json:"tproxy-port"`
	MixedPort      int           `json:"mixed-port"`
	Authentication []interface{} `json:"authentication"`
	AllowLan       bool          `json:"allow-lan"`
	BindAddress    string        `json:"bind-address"`
	Mode           string        `json:"mode"`
	LogLevel       string        `json:"log-level"`
	Ipv6           bool          `json:"ipv6"`
}

func GetConfigs

func GetConfigs() (*ConfigRestfulResponse, error)

type DelayTestResponse

type DelayTestResponse struct {
	Delay   int    `json:"delay"`
	Message string `json:"message"`
}

type Node

type Node struct {
	Name  string
	Type  string // ss, ssr, v2ray, trojan
	Delay int
}

type ProxyRestfulResponse

type ProxyRestfulResponse struct {
	History []struct {
		Time  time.Time `json:"time"`
		Delay int       `json:"delay"`
	} `json:"history"`
	Name string `json:"name"`
	Type string `json:"type"`
	Udp  bool   `json:"udp"`
}

type ProxySelectorResponse

type ProxySelectorResponse struct {
	All     []string `json:"all"`
	History []any    `json:"history"`
	Name    string   `json:"name"`
	Now     string   `json:"now"`
	Type    string   `json:"type"`
	Udp     bool     `json:"udp"`
}

Jump to

Keyboard shortcuts

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