structures

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindUserDiffer

func FindUserDiffer(before, now *[]UserInfo) (remove, add *[]UserInfo, err error)

Types

type Allocate

type Allocate struct {
	Strategy    string `json:"strategy"`
	Refresh     int    `json:"refresh"`
	Concurrency int    `json:"concurrency"`
}

type BaseConfig

type BaseConfig struct {
	Log   Log   `json:"log"`
	Panel Panel `json:"panel"`
	Proxy Proxy `json:"proxy"`
	Sync  Sync  `json:"sync"`
}

type Cert

type Cert struct {
	CertPath string `json:"cert_path"`
	KeyPath  string `json:"key_path"`
}

type Inbound

type Inbound struct {
	Listen         string         `json:"listen"`
	Port           int            `json:"port"`
	Protocol       string         `json:"protocol"`
	Settings       Settings       `json:"settings"`
	StreamSettings StreamSettings `json:"streamSettings"`
	Tag            string         `json:"tag"`
	Sniffing       Sniffing       `json:"sniffing"`
	Allocate       Allocate       `json:"allocate"`
}

type Log

type Log struct {
	LogLevel string `json:"log_level"`
	Access   string `json:"access"`
}

type NodeInfo

type NodeInfo struct {
	Id                  uint32
	IdIndex             uint32
	Tag                 string
	SpeedLimit          uint32 `json:"node_speedlimit"`
	Sort                uint32 `json:"sort"`
	RawInfo             string `json:"server"`
	Url                 string
	Protocol            string
	CipherType          string
	ListenPort          uint32
	AlterID             uint32
	EnableSniffing      bool
	EnableTLS           bool
	EnableProxyProtocol bool
	TransportMode       string
	Path                string
	Host                string
	Cert                Cert
}

type Panel

type Panel struct {
	Type               string   `json:"type"`
	URL                string   `json:"url"`
	Key                string   `json:"key"`
	NodeIDs            []uint32 `json:"node_ids"`
	NodesType          []string `json:"nodes_type"`
	NodesProxyProtocol []bool   `json:"nodes_proxy_protocol"`
}

type PanelCommand

type PanelCommand interface {
	Init(cfg *BaseConfig, idIndex uint32) error
	GetNodeInfo(closeTLS bool) (err error)
	GetUser() (userList *[]UserInfo, err error)
	PostTraffic(trafficData *[]UserTraffic) (err error)
	PostSysLoad(load *SysLoad) (err error)
	PostAliveIP(baseCfg *BaseConfig, userIP *[]UserIP) (err error)
	GetNowInfo() (nodeInfo *NodeInfo)
}

type Proxy

type Proxy struct {
	Type            string    `json:"type"`
	AlterID         uint32    `json:"alter_id"`
	AutoGenerate    bool      `json:"auto_generate"`
	InTags          []string  `json:"in_tags"`
	APIAddress      string    `json:"api_address"`
	APIPort         uint32    `json:"api_port"`
	ConfigPath      string    `json:"config_path"`
	LogPath         string    `json:"log_path"`
	ForceCloseTLS   bool      `json:"force_close_tls"`
	EnableSniffing  bool      `json:"enable_sniffing"`
	Cert            Cert      `json:"cert"`
	SpeedLimitLevel []float32 `json:"speed_limit_level"`
}

type ProxyCommand

type ProxyCommand interface {
	Init(cfg *BaseConfig) error
	AddUsers(user *[]UserInfo) error
	RemoveUsers(user *[]UserInfo) error
	QueryUsersTraffic(user *[]UserInfo) (*[]UserTraffic, error)
	AddInbound(node *NodeInfo) (err error)
	RemoveInbound(node *NodeInfo) (err error)
}

type Settings

type Settings struct {
}

type Sniffing

type Sniffing struct {
	Enabled      bool     `json:"enabled"`
	DestOverride []string `json:"destOverride"`
}

type StreamSettings

type StreamSettings struct {
}

type Sync

type Sync struct {
	Interval       uint32 `json:"interval"`
	FailDelay      uint32 `json:"fail_delay"`
	Timeout        uint32 `json:"timeout"`
	PostIPInterval uint32 `json:"post_ip_interval"`
}

type SysLoad

type SysLoad struct {
	Uptime uint64
	Load1  float64
	Load5  float64
	Load15 float64
}

type UserIP

type UserIP struct {
	Id      uint32
	InTag   string
	AliveIP []string
}

type UserInfo

type UserInfo struct {
	Id      uint32
	Uuid    string
	AlterId uint32
	// Level will use for speed limit
	Level uint32
	InTag string
	// Tag = Id + “-” + InTag
	Tag string
	// Protocol Vmess, trojan..
	Protocol   string
	CipherType string
	Password   string
	SpeedLimit uint32
	MaxClients uint32
	// 单端口承载用户标识,true代表该用户为单端口承载用户
	SSConfig bool
}

type UserTraffic

type UserTraffic struct {
	Id   uint32 `json:"user_id"`
	Up   int64  `json:"u"`
	Down int64  `json:"d"`
}

Jump to

Keyboard shortcuts

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