Modular 、Functional enhancement

This commit is contained in:
刘河
2019-04-08 17:01:08 +08:00
parent 0c87b4119a
commit 824b12a2f8
41 changed files with 754 additions and 242 deletions

View File

@@ -48,6 +48,7 @@ type Client struct {
WebUserName string //the username of web login
WebPassword string //the password of web login
ConfigConnAllow bool //is allow connected by config file
MaxTunnelNum int
sync.RWMutex
}
@@ -97,6 +98,17 @@ func (s *Client) HasTunnel(t *Tunnel) (exist bool) {
return
}
func (s *Client) GetTunnelNum() (num int) {
GetDb().JsonDb.Tasks.Range(func(key, value interface{}) bool {
v := value.(*Tunnel)
if v.Client.Id == s.Id {
num++
}
return true
})
return
}
func (s *Client) HasHost(h *Host) bool {
var has bool
GetDb().JsonDb.Hosts.Range(func(key, value interface{}) bool {
@@ -164,9 +176,10 @@ type Host struct {
}
type Target struct {
nowIndex int
TargetStr string
TargetArr []string
nowIndex int
TargetStr string
TargetArr []string
LocalProxy bool
sync.RWMutex
}