diff --git a/api/pmpanel/pmpanel.go b/api/pmpanel/pmpanel.go index 2fd8881..21e5dd8 100644 --- a/api/pmpanel/pmpanel.go +++ b/api/pmpanel/pmpanel.go @@ -473,7 +473,7 @@ func (c *APIClient) ParseTrojanNodeResponse(nodeInfoResponse *NodeInfoResponse) // ParseUserListResponse parse the response for the given nodeinfo format func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]api.UserInfo, error) { - var deviceLimit = 0 + var deviceLimit int = 0 var speedlimit uint64 = 0 userList := make([]api.UserInfo, len(*userInfoResponse)) for i, user := range *userInfoResponse { diff --git a/api/proxypanel/model.go b/api/proxypanel/model.go index 82bf112..483fb81 100644 --- a/api/proxypanel/model.go +++ b/api/proxypanel/model.go @@ -98,6 +98,7 @@ type NodeRuleItem struct { Pattern string `json:"pattern"` } +// IllegalReport type IllegalReport struct { UID int `json:"uid"` RuleID int `json:"rule_id"` diff --git a/api/proxypanel/proxypanel.go b/api/proxypanel/proxypanel.go index 2aa1533..026d88a 100644 --- a/api/proxypanel/proxypanel.go +++ b/api/proxypanel/proxypanel.go @@ -428,7 +428,7 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *json.RawMessage) (* if c.SpeedLimit > 0 { speedlimit = uint64((c.SpeedLimit * 1000000) / 8) } else { - speedlimit = (v2rayNodeInfo.SpeedLimit * 1000000) / 8 + speedlimit = uint64((v2rayNodeInfo.SpeedLimit * 1000000) / 8) } if c.DeviceLimit == 0 && v2rayNodeInfo.ClientLimit > 0 { @@ -464,7 +464,7 @@ func (c *APIClient) ParseSSNodeResponse(nodeInfoResponse *json.RawMessage) (*api if c.SpeedLimit > 0 { speedlimit = uint64((c.SpeedLimit * 1000000) / 8) } else { - speedlimit = (shadowsocksNodeInfo.SpeedLimit * 1000000) / 8 + speedlimit = uint64((shadowsocksNodeInfo.SpeedLimit * 1000000) / 8) } if c.DeviceLimit == 0 && shadowsocksNodeInfo.ClientLimit > 0 { @@ -501,7 +501,7 @@ func (c *APIClient) ParseTrojanNodeResponse(nodeInfoResponse *json.RawMessage) ( if c.SpeedLimit > 0 { speedlimit = uint64((c.SpeedLimit * 1000000) / 8) } else { - speedlimit = (trojanNodeInfo.SpeedLimit * 1000000) / 8 + speedlimit = uint64((trojanNodeInfo.SpeedLimit * 1000000) / 8) } if c.DeviceLimit == 0 && trojanNodeInfo.ClientLimit > 0 { @@ -536,7 +536,7 @@ func (c *APIClient) ParseV2rayUserListResponse(userInfoResponse *json.RawMessage if c.SpeedLimit > 0 { speedlimit = uint64((c.SpeedLimit * 1000000) / 8) } else { - speedlimit = (user.SpeedLimit * 1000000) / 8 + speedlimit = uint64((user.SpeedLimit * 1000000) / 8) } userList[i] = api.UserInfo{ UID: user.UID, @@ -592,7 +592,7 @@ func (c *APIClient) ParseSSUserListResponse(userInfoResponse *json.RawMessage) ( if c.SpeedLimit > 0 { speedlimit = uint64((c.SpeedLimit * 1000000) / 8) } else { - speedlimit = (user.SpeedLimit * 1000000) / 8 + speedlimit = uint64((user.SpeedLimit * 1000000) / 8) } userList[i] = api.UserInfo{ UID: user.UID, diff --git a/api/sspanel/sspanel.go b/api/sspanel/sspanel.go index 4c7d01e..be78710 100644 --- a/api/sspanel/sspanel.go +++ b/api/sspanel/sspanel.go @@ -21,7 +21,7 @@ import ( var ( firstPortRe = regexp.MustCompile(`(?m)port=(?P\d+)#?`) // First Port secondPortRe = regexp.MustCompile(`(?m)port=\d+#(\d+)`) // Second Port - hostRe = regexp.MustCompile(`(?m)host=([\w.]+)\|?`) // Host + hostRe = regexp.MustCompile(`(?m)host=([\w\.]+)\|?`) // Host ) // APIClient create a api client to the panel. @@ -677,7 +677,7 @@ func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[] c.access.Unlock() }() - var deviceLimit, localDeviceLimit = 0, 0 + var deviceLimit, localDeviceLimit int = 0, 0 var speedlimit uint64 = 0 var userList []api.UserInfo for _, user := range *userInfoResponse { diff --git a/api/v2board/v2board.go b/api/v2board/v2board.go index 6b84a27..b710475 100644 --- a/api/v2board/v2board.go +++ b/api/v2board/v2board.go @@ -354,7 +354,7 @@ func (c *APIClient) ParseSSNodeResponse() (*api.NodeInfo, error) { // ParseV2rayNodeResponse parse the response for the given nodeinfor format func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*api.NodeInfo, error) { - var TLSType = "tls" + var TLSType string = "tls" var path, host, serviceName string var header json.RawMessage var enableTLS bool diff --git a/api/v2raysocks/v2raysocks.go b/api/v2raysocks/v2raysocks.go index 63218b2..3366274 100644 --- a/api/v2raysocks/v2raysocks.go +++ b/api/v2raysocks/v2raysocks.go @@ -213,16 +213,16 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) { user.Email = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("secret").MustString() user.Passwd = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("secret").MustString() user.Method = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("cipher").MustString() - user.SpeedLimit = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("speed_limit").MustUint64() * 1000000 / 8 + user.SpeedLimit = uint64(response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("speed_limit").MustUint64() * 1000000 / 8) case "Trojan": user.UUID = response.Get("data").GetIndex(i).Get("trojan_user").Get("password").MustString() user.Email = response.Get("data").GetIndex(i).Get("trojan_user").Get("password").MustString() - user.SpeedLimit = response.Get("data").GetIndex(i).Get("trojan_user").Get("speed_limit").MustUint64() * 1000000 / 8 + user.SpeedLimit = uint64(response.Get("data").GetIndex(i).Get("trojan_user").Get("speed_limit").MustUint64() * 1000000 / 8) case "V2ray": user.UUID = response.Get("data").GetIndex(i).Get("v2ray_user").Get("uuid").MustString() user.Email = response.Get("data").GetIndex(i).Get("v2ray_user").Get("email").MustString() user.AlterID = uint16(response.Get("data").GetIndex(i).Get("v2ray_user").Get("alter_id").MustUint64()) - user.SpeedLimit = response.Get("data").GetIndex(i).Get("v2ray_user").Get("speed_limit").MustUint64() * 1000000 / 8 + user.SpeedLimit = uint64(response.Get("data").GetIndex(i).Get("v2ray_user").Get("speed_limit").MustUint64() * 1000000 / 8) } if c.SpeedLimit > 0 { user.SpeedLimit = uint64((c.SpeedLimit * 1000000) / 8) @@ -354,7 +354,7 @@ func (c *APIClient) ParseSSNodeResponse(nodeInfoResponse *simplejson.Json) (*api // ParseV2rayNodeResponse parse the response for the given nodeinfor format func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*api.NodeInfo, error) { - var TLSType = "tls" + var TLSType string = "tls" var path, host, serviceName string var header json.RawMessage var enableTLS bool diff --git a/common/mylego/model.go b/common/mylego/model.go index d6a3fad..5e565b1 100644 --- a/common/mylego/model.go +++ b/common/mylego/model.go @@ -2,7 +2,6 @@ package mylego type CertConfig struct { CertMode string `mapstructure:"CertMode"` // none, file, http, dns - VerifyClientCertificate bool `mapstructure:"VerifyClientCertificate"` CertDomain string `mapstructure:"CertDomain"` CertFile string `mapstructure:"CertFile"` KeyFile string `mapstructure:"KeyFile"` diff --git a/common/mylego/mylego.go b/common/mylego/mylego.go index 81f8429..63e45d4 100644 --- a/common/mylego/mylego.go +++ b/common/mylego/mylego.go @@ -14,7 +14,7 @@ var defaultPath string func New(certConf *CertConfig) (*LegoCMD, error) { // Set default path to configPath/cert var p = "" - configPath := os.Getenv("V2RAY_LOCATION_CONFIG") + configPath := os.Getenv("XRAY_LOCATION_CONFIG") if configPath != "" { p = configPath } else if cwd, err := os.Getwd(); err == nil {