mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
update config
This commit is contained in:
38
api/api.go
38
api/api.go
@@ -14,13 +14,13 @@ import (
|
||||
// API is the interface for different panel's api.
|
||||
|
||||
type Config struct {
|
||||
APIHost string `mapstructure:"ApiHost"`
|
||||
NodeID int `mapstructure:"NodeID"`
|
||||
Key string `mapstructure:"ApiKey"`
|
||||
NodeType string `mapstructure:"NodeType"`
|
||||
EnableVless bool `mapstructure:"EnableVless"`
|
||||
EnableXTLS bool `mapstructure:"EnableXTLS"`
|
||||
EnableSS2022 bool `mapstructure:"EnableSS2022"`
|
||||
APIHost string `mapstructure:"ApiHost"`
|
||||
NodeID int `mapstructure:"NodeID"`
|
||||
Key string `mapstructure:"ApiKey"`
|
||||
NodeType string `mapstructure:"NodeType"`
|
||||
EnableVless bool `mapstructure:"EnableVless"`
|
||||
EnableXTLS bool `mapstructure:"EnableXTLS"`
|
||||
//EnableSS2022 bool `mapstructure:"EnableSS2022"`
|
||||
Timeout int `mapstructure:"Timeout"`
|
||||
SpeedLimit float64 `mapstructure:"SpeedLimit"`
|
||||
DeviceLimit int `mapstructure:"DeviceLimit"`
|
||||
@@ -36,12 +36,12 @@ type ClientInfo struct {
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
client *resty.Client
|
||||
APIHost string
|
||||
NodeID int
|
||||
Key string
|
||||
NodeType string
|
||||
EnableSS2022 bool
|
||||
client *resty.Client
|
||||
APIHost string
|
||||
NodeID int
|
||||
Key string
|
||||
NodeType string
|
||||
//EnableSS2022 bool
|
||||
EnableVless bool
|
||||
EnableXTLS bool
|
||||
SpeedLimit float64
|
||||
@@ -78,12 +78,12 @@ func New(apiConfig *Config) API {
|
||||
// Read local rule list
|
||||
localRuleList := readLocalRuleList(apiConfig.RuleListPath)
|
||||
apiClient := &Client{
|
||||
client: client,
|
||||
NodeID: apiConfig.NodeID,
|
||||
Key: apiConfig.Key,
|
||||
APIHost: apiConfig.APIHost,
|
||||
NodeType: apiConfig.NodeType,
|
||||
EnableSS2022: apiConfig.EnableSS2022,
|
||||
client: client,
|
||||
NodeID: apiConfig.NodeID,
|
||||
Key: apiConfig.Key,
|
||||
APIHost: apiConfig.APIHost,
|
||||
NodeType: apiConfig.NodeType,
|
||||
//EnableSS2022: apiConfig.EnableSS2022,
|
||||
EnableVless: apiConfig.EnableVless,
|
||||
EnableXTLS: apiConfig.EnableXTLS,
|
||||
SpeedLimit: apiConfig.SpeedLimit,
|
||||
|
||||
@@ -18,7 +18,6 @@ func (c *Client) Debug() {
|
||||
func (c *Client) assembleURL(path string) string {
|
||||
return c.APIHost + path
|
||||
}
|
||||
|
||||
func (c *Client) checkResponse(res *resty.Response, path string, err error) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("request %s failed: %s", c.assembleURL(path), err)
|
||||
|
||||
Reference in New Issue
Block a user