Documentation
¶
Index ¶
- Variables
- func GetAccountMap(multiAccount *MultiAccount) map[string]string
- func GetMapKeys(m *sync.Map, isSort bool, sortKey, order string) (keys []int)
- type Client
- type Config
- type DbUtils
- func (s *DbUtils) DelClient(id int) error
- func (s *DbUtils) DelHost(id int) error
- func (s *DbUtils) DelTask(id int) error
- func (s *DbUtils) FindCertByHost(host string) (*Host, error)
- func (s *DbUtils) GetClient(id int) (c *Client, err error)
- func (s *DbUtils) GetClientIdByBlake2bVkey(vkey string) (id int, err error)
- func (s *DbUtils) GetClientIdByMd5Vkey(vkey string) (id int, err error)
- func (s *DbUtils) GetClientList(start, length int, search, sort, order string, clientId int) ([]*Client, int)
- func (s *DbUtils) GetGlobal() (c *Glob)
- func (s *DbUtils) GetHost(start, length int, id int, search string) ([]*Host, int)
- func (s *DbUtils) GetHostById(id int) (h *Host, err error)
- func (s *DbUtils) GetIdByVerifyKey(vKey, addr, localAddr string, hashFunc func(string) string) (id int, err error)
- func (s *DbUtils) GetInfoByHost(host string, r *http.Request) (h *Host, err error)
- func (s *DbUtils) GetTask(id int) (t *Tunnel, err error)
- func (s *DbUtils) GetTaskByMd5Password(p string) (t *Tunnel)
- func (s *DbUtils) GetTaskByMd5PasswordOld(p string) (t *Tunnel)
- func (s *DbUtils) IsHostExist(h *Host) bool
- func (s *DbUtils) IsHostModify(h *Host) bool
- func (s *DbUtils) IsPubClient(id int) bool
- func (s *DbUtils) NewClient(c *Client) error
- func (s *DbUtils) NewHost(t *Host) error
- func (s *DbUtils) NewTask(t *Tunnel) (err error)
- func (s *DbUtils) SaveGlobal(t *Glob) error
- func (s *DbUtils) UpdateClient(t *Client) error
- func (s *DbUtils) UpdateTask(t *Tunnel) error
- func (s *DbUtils) VerifyUserName(username string, id int) (res bool)
- func (s *DbUtils) VerifyVkey(vkey string, id int) (res bool)
- type Flow
- type Glob
- type Health
- type Host
- type JsonDb
- func (s *JsonDb) GetClient(id int) (c *Client, err error)
- func (s *JsonDb) GetClientId() int32
- func (s *JsonDb) GetHostId() int32
- func (s *JsonDb) GetTaskId() int32
- func (s *JsonDb) LoadClientFromJsonFile()
- func (s *JsonDb) LoadGlobalFromJsonFile()
- func (s *JsonDb) LoadHostFromJsonFile()
- func (s *JsonDb) LoadTaskFromJsonFile()
- func (s *JsonDb) StoreClientsToJsonFile()
- func (s *JsonDb) StoreGlobalToJsonFile()
- func (s *JsonDb) StoreHostToJsonFile()
- func (s *JsonDb) StoreTasksToJsonFile()
- type MultiAccount
- type Pair
- type PairList
- type Target
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Db *DbUtils HostIndex = index.NewDomainIndex() Blake2bVkeyIndex = index.NewStringIDIndex() TaskPasswordIndex = index.NewStringIDIndex() )
Functions ¶
func GetAccountMap ¶ added in v0.26.47
func GetAccountMap(multiAccount *MultiAccount) map[string]string
Types ¶
type Client ¶
type Client struct {
Cnf *Config
Id int //id
VerifyKey string //verify key
Mode string //bridge mode
Addr string //the ip of client
LocalAddr string //the local ip of client
Remark string //remark
Status bool //is allowed connect
IsConnect bool //is the client connect
RateLimit int //rate /kb
Flow *Flow //flow setting
ExportFlow int64 //flow out
InletFlow int64 //flow in
Rate *rate.Rate //rate limit
NoStore bool //no store to file
NoDisplay bool //no display on web
MaxConn int //the max connection num of client allow
NowConn int32 //the connection num of now
WebUserName string //the username of web login
WebPassword string //the password of web login
WebTotpSecret string //the totp secret of web login
ConfigConnAllow bool //is allowed connected by config file
MaxTunnelNum int
Version string
BlackIpList []string
CreateTime string
LastOnlineTime string
sync.RWMutex
}
func (*Client) EnsureWebPassword ¶ added in v0.29.30
func (s *Client) EnsureWebPassword()
func (*Client) GetTunnelNum ¶
type DbUtils ¶
type DbUtils struct {
JsonDb *JsonDb
}
func (*DbUtils) GetClientIdByBlake2bVkey ¶ added in v0.29.9
func (*DbUtils) GetClientIdByMd5Vkey ¶ added in v0.27.0
func (*DbUtils) GetClientList ¶
func (*DbUtils) GetIdByVerifyKey ¶
func (*DbUtils) GetInfoByHost ¶
GetInfoByHost get key by host from x
func (*DbUtils) GetTaskByMd5Password ¶
GetTaskByMd5Password md5 password
func (*DbUtils) GetTaskByMd5PasswordOld ¶ added in v0.29.9
func (*DbUtils) IsHostExist ¶
func (*DbUtils) IsHostModify ¶
func (*DbUtils) IsPubClient ¶
func (*DbUtils) SaveGlobal ¶
func (*DbUtils) UpdateClient ¶
func (*DbUtils) UpdateTask ¶
func (*DbUtils) VerifyUserName ¶
type Flow ¶
type Host ¶
type Host struct {
Id int
Host string //host
HeaderChange string //request header change
RespHeaderChange string //response header change
HostChange string //host change
Location string //url router
PathRewrite string //url rewrite
Remark string //remark
Scheme string //http https all
RedirectURL string // 307
HttpsJustProxy bool
TlsOffload bool
AutoSSL bool
CertType string
CertHash string
CertFile string
KeyFile string
NoStore bool
IsClose bool
AutoHttps bool
AutoCORS bool
CompatMode bool
Flow *Flow
NowConn int32
Client *Client
TargetIsHttps bool
Target *Target //目标
UserAuth *MultiAccount
MultiAccount *MultiAccount
Health `json:"-"`
sync.RWMutex
}
type JsonDb ¶
type JsonDb struct {
Tasks sync.Map
Hosts sync.Map
HostsTmp sync.Map
Clients sync.Map
Global *Glob
RunPath string
ClientIncreaseId int32 //client increased id
TaskIncreaseId int32 //task increased id
HostIncreaseId int32 //host increased id
TaskFilePath string //task file path
HostFilePath string //host file path
ClientFilePath string //client file path
GlobalFilePath string //global file path
}
func (*JsonDb) GetClientId ¶
func (*JsonDb) LoadClientFromJsonFile ¶
func (s *JsonDb) LoadClientFromJsonFile()
func (*JsonDb) LoadGlobalFromJsonFile ¶
func (s *JsonDb) LoadGlobalFromJsonFile()
func (*JsonDb) LoadHostFromJsonFile ¶
func (s *JsonDb) LoadHostFromJsonFile()
func (*JsonDb) LoadTaskFromJsonFile ¶
func (s *JsonDb) LoadTaskFromJsonFile()
func (*JsonDb) StoreClientsToJsonFile ¶
func (s *JsonDb) StoreClientsToJsonFile()
func (*JsonDb) StoreGlobalToJsonFile ¶
func (s *JsonDb) StoreGlobalToJsonFile()
func (*JsonDb) StoreHostToJsonFile ¶
func (s *JsonDb) StoreHostToJsonFile()
func (*JsonDb) StoreTasksToJsonFile ¶
func (s *JsonDb) StoreTasksToJsonFile()
type MultiAccount ¶
type Pair ¶
type Pair struct {
// contains filtered or unexported fields
}
Pair A data structure to hold a key/value pair.
type PairList ¶
type PairList []*Pair
PairList A slice of Pairs that implements sort.Interface to sort by Value.
type Target ¶
type Target struct {
TargetStr string
TargetArr []string
LocalProxy bool
ProxyProtocol int // Proxy Protocol 配置:0=关闭, 1=v1, 2=v2
sync.RWMutex
// contains filtered or unexported fields
}
func (*Target) GetRandomTarget ¶
type Tunnel ¶
type Tunnel struct {
Id int
Port int
ServerIp string
Mode string
Status bool
RunStatus bool
Client *Client
Ports string
Flow *Flow
NowConn int32
Password string
Remark string
TargetAddr string
TargetType string
NoStore bool
IsHttp bool
HttpProxy bool
Socks5Proxy bool
LocalPath string
StripPre string
ReadOnly bool
Target *Target
UserAuth *MultiAccount
MultiAccount *MultiAccount
Health
sync.RWMutex
}
func NewTunnelByHost ¶ added in v0.33.9
Click to show internal directories.
Click to hide internal directories.