structures

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: GPL-3.0 Imports: 2 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 added in v0.3.1

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

type BaseConfig

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

type Cert added in v0.3.1

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

type Inbound added in v0.3.1

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 NodeInfo added in v0.3.1

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
	ListenPort          uint32
	AlertID             uint32
	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"`
}

type PanelCmd added in v0.3.1

type PanelCmd interface {
	GetNodeInfo(cfg *BaseConfig, idIndex uint32) (changed bool, err error)
	GetUser(cfg *BaseConfig) (userList *[]UserInfo, err error)
	PostTraffic(cfg *BaseConfig, trafficData *[]UserTraffic) (ret int, err error)

	AddInbound(apiClient *interface{}) (ret int, err error)
}

type Proxy

type Proxy struct {
	Type         string   `json:"type"`
	AlertID      uint32   `json:"alert_id"`
	AutoGenerate bool     `json:"auto_generate"`
	InTags       []string `json:"in_tags"`
	APIAddress   string   `json:"api_address"`
	APIPort      uint32   `json:"api_port"`
	LogPath      string   `json:"log_path"`
	Cert         Cert     `json:"cert"`
}

type ProxyCommand added in v0.3.1

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)
	//AddTrojanInbound()
	//AddSSInbound()
	RemoveInbound(node *NodeInfo) (err error)
}

type Settings added in v0.3.1

type Settings struct {
}

type Sniffing added in v0.3.1

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

type StreamSettings added in v0.3.1

type StreamSettings struct {
}

type Sync

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

type UserIP added in v0.2.0

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

type UserInfo

type UserInfo struct {
	Id      uint32
	Uuid    string
	AlertId uint32
	// Level will use for speed limit
	Level uint32
	InTag string
	// Tag = Id + “-” + InTag
	Tag string
	// Protocol Vmess, trojan..
	Protocol   string
	SpeedLimit uint32
	MaxClients uint32
}

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