mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-06-14 08:19:54 +00:00
fix: fix cert storage path
This commit is contained in:
parent
9c356cd28c
commit
f50c61c782
@ -473,7 +473,7 @@ func (c *APIClient) ParseTrojanNodeResponse(nodeInfoResponse *NodeInfoResponse)
|
|||||||
|
|
||||||
// ParseUserListResponse parse the response for the given nodeinfo format
|
// ParseUserListResponse parse the response for the given nodeinfo format
|
||||||
func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]api.UserInfo, error) {
|
func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]api.UserInfo, error) {
|
||||||
var deviceLimit = 0
|
var deviceLimit int = 0
|
||||||
var speedlimit uint64 = 0
|
var speedlimit uint64 = 0
|
||||||
userList := make([]api.UserInfo, len(*userInfoResponse))
|
userList := make([]api.UserInfo, len(*userInfoResponse))
|
||||||
for i, user := range *userInfoResponse {
|
for i, user := range *userInfoResponse {
|
||||||
|
@ -98,6 +98,7 @@ type NodeRuleItem struct {
|
|||||||
Pattern string `json:"pattern"`
|
Pattern string `json:"pattern"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IllegalReport
|
||||||
type IllegalReport struct {
|
type IllegalReport struct {
|
||||||
UID int `json:"uid"`
|
UID int `json:"uid"`
|
||||||
RuleID int `json:"rule_id"`
|
RuleID int `json:"rule_id"`
|
||||||
|
@ -428,7 +428,7 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *json.RawMessage) (*
|
|||||||
if c.SpeedLimit > 0 {
|
if c.SpeedLimit > 0 {
|
||||||
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
||||||
} else {
|
} else {
|
||||||
speedlimit = (v2rayNodeInfo.SpeedLimit * 1000000) / 8
|
speedlimit = uint64((v2rayNodeInfo.SpeedLimit * 1000000) / 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.DeviceLimit == 0 && v2rayNodeInfo.ClientLimit > 0 {
|
if c.DeviceLimit == 0 && v2rayNodeInfo.ClientLimit > 0 {
|
||||||
@ -464,7 +464,7 @@ func (c *APIClient) ParseSSNodeResponse(nodeInfoResponse *json.RawMessage) (*api
|
|||||||
if c.SpeedLimit > 0 {
|
if c.SpeedLimit > 0 {
|
||||||
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
||||||
} else {
|
} else {
|
||||||
speedlimit = (shadowsocksNodeInfo.SpeedLimit * 1000000) / 8
|
speedlimit = uint64((shadowsocksNodeInfo.SpeedLimit * 1000000) / 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.DeviceLimit == 0 && shadowsocksNodeInfo.ClientLimit > 0 {
|
if c.DeviceLimit == 0 && shadowsocksNodeInfo.ClientLimit > 0 {
|
||||||
@ -501,7 +501,7 @@ func (c *APIClient) ParseTrojanNodeResponse(nodeInfoResponse *json.RawMessage) (
|
|||||||
if c.SpeedLimit > 0 {
|
if c.SpeedLimit > 0 {
|
||||||
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
||||||
} else {
|
} else {
|
||||||
speedlimit = (trojanNodeInfo.SpeedLimit * 1000000) / 8
|
speedlimit = uint64((trojanNodeInfo.SpeedLimit * 1000000) / 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.DeviceLimit == 0 && trojanNodeInfo.ClientLimit > 0 {
|
if c.DeviceLimit == 0 && trojanNodeInfo.ClientLimit > 0 {
|
||||||
@ -536,7 +536,7 @@ func (c *APIClient) ParseV2rayUserListResponse(userInfoResponse *json.RawMessage
|
|||||||
if c.SpeedLimit > 0 {
|
if c.SpeedLimit > 0 {
|
||||||
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
||||||
} else {
|
} else {
|
||||||
speedlimit = (user.SpeedLimit * 1000000) / 8
|
speedlimit = uint64((user.SpeedLimit * 1000000) / 8)
|
||||||
}
|
}
|
||||||
userList[i] = api.UserInfo{
|
userList[i] = api.UserInfo{
|
||||||
UID: user.UID,
|
UID: user.UID,
|
||||||
@ -592,7 +592,7 @@ func (c *APIClient) ParseSSUserListResponse(userInfoResponse *json.RawMessage) (
|
|||||||
if c.SpeedLimit > 0 {
|
if c.SpeedLimit > 0 {
|
||||||
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
speedlimit = uint64((c.SpeedLimit * 1000000) / 8)
|
||||||
} else {
|
} else {
|
||||||
speedlimit = (user.SpeedLimit * 1000000) / 8
|
speedlimit = uint64((user.SpeedLimit * 1000000) / 8)
|
||||||
}
|
}
|
||||||
userList[i] = api.UserInfo{
|
userList[i] = api.UserInfo{
|
||||||
UID: user.UID,
|
UID: user.UID,
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
firstPortRe = regexp.MustCompile(`(?m)port=(?P<outport>\d+)#?`) // First Port
|
firstPortRe = regexp.MustCompile(`(?m)port=(?P<outport>\d+)#?`) // First Port
|
||||||
secondPortRe = regexp.MustCompile(`(?m)port=\d+#(\d+)`) // Second 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.
|
// APIClient create a api client to the panel.
|
||||||
@ -677,7 +677,7 @@ func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]
|
|||||||
c.access.Unlock()
|
c.access.Unlock()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var deviceLimit, localDeviceLimit = 0, 0
|
var deviceLimit, localDeviceLimit int = 0, 0
|
||||||
var speedlimit uint64 = 0
|
var speedlimit uint64 = 0
|
||||||
var userList []api.UserInfo
|
var userList []api.UserInfo
|
||||||
for _, user := range *userInfoResponse {
|
for _, user := range *userInfoResponse {
|
||||||
|
@ -354,7 +354,7 @@ func (c *APIClient) ParseSSNodeResponse() (*api.NodeInfo, error) {
|
|||||||
|
|
||||||
// ParseV2rayNodeResponse parse the response for the given nodeinfor format
|
// ParseV2rayNodeResponse parse the response for the given nodeinfor format
|
||||||
func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*api.NodeInfo, error) {
|
func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*api.NodeInfo, error) {
|
||||||
var TLSType = "tls"
|
var TLSType string = "tls"
|
||||||
var path, host, serviceName string
|
var path, host, serviceName string
|
||||||
var header json.RawMessage
|
var header json.RawMessage
|
||||||
var enableTLS bool
|
var enableTLS bool
|
||||||
|
@ -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.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.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.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":
|
case "Trojan":
|
||||||
user.UUID = response.Get("data").GetIndex(i).Get("trojan_user").Get("password").MustString()
|
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.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":
|
case "V2ray":
|
||||||
user.UUID = response.Get("data").GetIndex(i).Get("v2ray_user").Get("uuid").MustString()
|
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.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.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 {
|
if c.SpeedLimit > 0 {
|
||||||
user.SpeedLimit = uint64((c.SpeedLimit * 1000000) / 8)
|
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
|
// ParseV2rayNodeResponse parse the response for the given nodeinfor format
|
||||||
func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*api.NodeInfo, error) {
|
func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*api.NodeInfo, error) {
|
||||||
var TLSType = "tls"
|
var TLSType string = "tls"
|
||||||
var path, host, serviceName string
|
var path, host, serviceName string
|
||||||
var header json.RawMessage
|
var header json.RawMessage
|
||||||
var enableTLS bool
|
var enableTLS bool
|
||||||
|
@ -2,7 +2,6 @@ package mylego
|
|||||||
|
|
||||||
type CertConfig struct {
|
type CertConfig struct {
|
||||||
CertMode string `mapstructure:"CertMode"` // none, file, http, dns
|
CertMode string `mapstructure:"CertMode"` // none, file, http, dns
|
||||||
VerifyClientCertificate bool `mapstructure:"VerifyClientCertificate"`
|
|
||||||
CertDomain string `mapstructure:"CertDomain"`
|
CertDomain string `mapstructure:"CertDomain"`
|
||||||
CertFile string `mapstructure:"CertFile"`
|
CertFile string `mapstructure:"CertFile"`
|
||||||
KeyFile string `mapstructure:"KeyFile"`
|
KeyFile string `mapstructure:"KeyFile"`
|
||||||
|
@ -14,7 +14,7 @@ var defaultPath string
|
|||||||
func New(certConf *CertConfig) (*LegoCMD, error) {
|
func New(certConf *CertConfig) (*LegoCMD, error) {
|
||||||
// Set default path to configPath/cert
|
// Set default path to configPath/cert
|
||||||
var p = ""
|
var p = ""
|
||||||
configPath := os.Getenv("V2RAY_LOCATION_CONFIG")
|
configPath := os.Getenv("XRAY_LOCATION_CONFIG")
|
||||||
if configPath != "" {
|
if configPath != "" {
|
||||||
p = configPath
|
p = configPath
|
||||||
} else if cwd, err := os.Getwd(); err == nil {
|
} else if cwd, err := os.Getwd(); err == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user