diff --git a/install.sh b/install.sh index 3772ac99..a3ad2895 100644 --- a/install.sh +++ b/install.sh @@ -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" diff --git a/option/xboard.go b/option/xboard.go index 21d319ee..fb21f7a5 100644 --- a/option/xboard.go +++ b/option/xboard.go @@ -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"` }