mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
change project structure
add across nodes ip limit add user ip recorder del config file watch
This commit is contained in:
19
api/api.go
19
api/api.go
@@ -4,6 +4,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/Yuzuki616/V2bX/conf"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"log"
|
||||
"strconv"
|
||||
@@ -13,21 +14,6 @@ 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"`
|
||||
Timeout int `mapstructure:"Timeout"`
|
||||
SpeedLimit float64 `mapstructure:"SpeedLimit"`
|
||||
DeviceLimit int `mapstructure:"DeviceLimit"`
|
||||
RuleListPath string `mapstructure:"RuleListPath"`
|
||||
DisableCustomConfig bool `mapstructure:"DisableCustomConfig"`
|
||||
}
|
||||
|
||||
type ClientInfo struct {
|
||||
APIHost string
|
||||
NodeID int
|
||||
@@ -53,8 +39,7 @@ type Client struct {
|
||||
NodeRuleRspMd5 [16]byte
|
||||
}
|
||||
|
||||
func New(apiConfig *Config) API {
|
||||
|
||||
func New(apiConfig *conf.ApiConfig) API {
|
||||
client := resty.New()
|
||||
client.SetRetryCount(3)
|
||||
if apiConfig.Timeout > 0 {
|
||||
|
||||
Reference in New Issue
Block a user