修复无法通过编译的错误

This commit is contained in:
CN-JS-HuiBai
2026-04-14 23:09:07 +08:00
parent 5d63f2581a
commit 81d814515f
2 changed files with 19 additions and 7 deletions

View File

@@ -94,15 +94,25 @@ build_sing_box() {
# Build params from Makefile
VERSION=$(git rev-parse --short HEAD 2>/dev/null || echo "custom")
TAGS="with_quic,with_shadowsocks,with_v2rayapi,with_utls,with_clash_api,with_gvisor"
# Reduced tags for safer build on smaller servers
TAGS="with_quic,with_utls,with_clash_api,with_gvisor"
echo -e "${YELLOW}Starting compilation (this may take a few minutes)...${NC}"
echo -e "${YELLOW}Note: Using -p 1 to save memory and avoid silent crashes.${NC}"
# Use -o to be explicit about output location
go build -v -trimpath \
# Use -p 1 to limit parallel builds (prevent OOM spikes)
# Redirect stderr to stdout to see errors clearly
if ! go build -v -p 1 -trimpath \
-o "$BINARY_PATH" \
-ldflags "-X 'github.com/sagernet/sing-box/constant.Version=$VERSION' -s -w" \
-tags "$TAGS" \
./cmd/sing-box
./cmd/sing-box 2>&1; then
echo -e "${RED}Compilation process failed or was terminated.${NC}"
echo -e "${YELLOW}Checking system status...${NC}"
free -m
exit 1
fi
if [[ -f "$BINARY_PATH" ]]; then
chmod +x "$BINARY_PATH"

View File

@@ -1,14 +1,16 @@
package option
import (
"encoding/json"
"github.com/sagernet/sing/common/json/badoption"
)
type XBoardServiceOptions struct {
PanelURL string `json:"panel_url"`
Key string `json:"key"`
NodeID int `json:"node_id"`
NodeOptions badoption.RawMessage `json:"node_options,omitempty"`
PanelURL string `json:"panel_url"`
Key string `json:"key"`
NodeID int `json:"node_id"`
NodeOptions json.RawMessage `json:"node_options,omitempty"`
SyncInterval badoption.Duration `json:"sync_interval,omitempty"`
ReportInterval badoption.Duration `json:"report_interval,omitempty"`
}