出问题那个用户对应的客户端订阅参数
This commit is contained in:
@@ -135,12 +135,10 @@ if ! [[ "$NODE_COUNT" =~ ^[0-9]+$ ]] || [[ "$NODE_COUNT" -lt 1 ]]; then
|
||||
fi
|
||||
|
||||
declare -a NODE_IDS
|
||||
declare -a NODE_TYPES
|
||||
declare -a NODE_TAGS
|
||||
|
||||
for ((i=1; i<=NODE_COUNT; i++)); do
|
||||
DEFAULT_NODE_ID=""
|
||||
DEFAULT_NODE_TYPE="${NODE_TYPE:-vless}"
|
||||
DEFAULT_NODE_TAG=""
|
||||
if [[ "$i" -eq 1 && -n "$NODE_ID" ]]; then
|
||||
DEFAULT_NODE_ID="$NODE_ID"
|
||||
@@ -151,12 +149,9 @@ for ((i=1; i<=NODE_COUNT; i++)); do
|
||||
echo -e "${RED}Node ID is required for node #$i${NC}"
|
||||
exit 1
|
||||
fi
|
||||
read -p "Enter Node Type for node #$i [${DEFAULT_NODE_TYPE}]: " INPUT_TYPE
|
||||
CURRENT_NODE_TYPE=${INPUT_TYPE:-$DEFAULT_NODE_TYPE}
|
||||
read -p "Enter Tag for node #$i (optional) [${DEFAULT_NODE_TAG}]: " INPUT_TAG
|
||||
CURRENT_NODE_TAG=${INPUT_TAG:-$DEFAULT_NODE_TAG}
|
||||
NODE_IDS+=("$CURRENT_NODE_ID")
|
||||
NODE_TYPES+=("$CURRENT_NODE_TYPE")
|
||||
NODE_TAGS+=("$CURRENT_NODE_TAG")
|
||||
done
|
||||
|
||||
@@ -190,7 +185,6 @@ if [[ "$NODE_COUNT" -eq 1 ]]; then
|
||||
SERVICE_JSON+=$(cat <<EOF
|
||||
,
|
||||
"node_id": ${NODE_IDS[0]},
|
||||
"node_type": "${NODE_TYPES[0]}",
|
||||
"config_node_id": ${NODE_IDS[0]},
|
||||
"user_node_id": ${NODE_IDS[0]}
|
||||
EOF
|
||||
@@ -203,8 +197,7 @@ SERVICE_JSON+=$',
|
||||
{
|
||||
"node_id": ${NODE_IDS[$i]},
|
||||
"config_node_id": ${NODE_IDS[$i]},
|
||||
"user_node_id": ${NODE_IDS[$i]},
|
||||
"node_type": "${NODE_TYPES[$i]}"
|
||||
"user_node_id": ${NODE_IDS[$i]}
|
||||
EOF
|
||||
)
|
||||
if [[ -n "${NODE_TAGS[$i]}" ]]; then
|
||||
|
||||
@@ -12,7 +12,7 @@ type XBoardServiceOptions struct {
|
||||
NodeID int `json:"node_id"`
|
||||
ConfigNodeID int `json:"config_node_id,omitempty"`
|
||||
UserNodeID int `json:"user_node_id,omitempty"`
|
||||
NodeType string `json:"node_type"`
|
||||
NodeType string `json:"node_type,omitempty"`
|
||||
SyncInterval badoption.Duration `json:"sync_interval,omitempty"`
|
||||
ReportInterval badoption.Duration `json:"report_interval,omitempty"`
|
||||
Nodes []XBoardNodeOptions `json:"nodes,omitempty"`
|
||||
|
||||
@@ -1038,9 +1038,9 @@ func normalizePanelNodeType(nodeType string) string {
|
||||
|
||||
func (s *Service) panelRequest(method string, baseURL string, endpoint string, nodeID int, payload []byte, contentType string) (http.Header, []byte, int, error) {
|
||||
nodeType := normalizePanelNodeType(s.options.NodeType)
|
||||
nodeTypeCandidates := []string{nodeType}
|
||||
nodeTypeCandidates := []string{""}
|
||||
if nodeType != "" {
|
||||
nodeTypeCandidates = append(nodeTypeCandidates, "")
|
||||
nodeTypeCandidates = append(nodeTypeCandidates, nodeType)
|
||||
}
|
||||
|
||||
var lastHeader http.Header
|
||||
@@ -1089,8 +1089,8 @@ func (s *Service) panelRequest(method string, baseURL string, endpoint string, n
|
||||
lastBody = responseBody
|
||||
lastStatus = resp.StatusCode
|
||||
|
||||
if resp.StatusCode == 400 && candidate != "" && strings.Contains(string(responseBody), "Server does not exist") && index+1 < len(nodeTypeCandidates) {
|
||||
s.logger.Warn("Xboard panel request failed with node_type=", candidate, ", retrying without node_type")
|
||||
if resp.StatusCode == 400 && candidate == "" && strings.Contains(string(responseBody), "Server does not exist") && index+1 < len(nodeTypeCandidates) {
|
||||
s.logger.Warn("Xboard panel request failed without node_type, retrying with configured node_type=", nodeType)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user