{"record":{"id":"59252c97567c700e","repo":"txthinking/brook","slug":"socks5-server-requires-a-clear-ip-for-udp-only-po","errorCode":null,"errorMessage":"socks5 server requires a clear IP for UDP, only port is not enough. You may use loopback IP or lan IP or other, we can not decide for you","messagePattern":"socks5 server requires a clear IP for UDP, only port is not enough\\. You may use loopback IP or lan IP or other, we can not decide for you","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/brook/main.go","lineNumber":480,"sourceCode":"\t\t\t\t}\n\t\t\t\tvar link = \"\"\n\t\t\t\tif c.String(\"server\") != \"\" {\n\t\t\t\t\tv := url.Values{}\n\t\t\t\t\tv.Set(\"password\", c.String(\"password\"))\n\t\t\t\t\tlink = brook.Link(\"server\", c.String(\"server\"), v)\n\t\t\t\t}\n\t\t\t\tif c.String(\"link\") != \"\" {\n\t\t\t\t\tlink = c.String(\"link\")\n\t\t\t\t}\n\t\t\t\th, p, err := net.SplitHostPort(c.String(\"socks5\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif c.String(\"socks5ServerIP\") != \"\" {\n\t\t\t\t\th = c.String(\"socks5ServerIP\")\n\t\t\t\t}\n\t\t\t\tif h == \"\" {\n\t\t\t\t\treturn errors.New(\"socks5 server requires a clear IP for UDP, only port is not enough. You may use loopback IP or lan IP or other, we can not decide for you\")\n\t\t\t\t}\n\t\t\t\tkind, _, v, err := brook.ParseLink(link)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif s := v.Get(\"clientHKDFInfo\"); s != \"\" {\n\t\t\t\t\tbrook.ClientHKDFInfo = []byte(s)\n\t\t\t\t}\n\t\t\t\tif s := v.Get(\"serverHKDFInfo\"); s != \"\" {\n\t\t\t\t\tbrook.ServerHKDFInfo = []byte(s)\n\t\t\t\t}\n\t\t\t\tif kind == \"socks5\" {\n\t\t\t\t\treturn errors.New(\"Looks like you want create socks5 from a socks5, you may want $ brook socks5tohttp?\")\n\t\t\t\t}\n\t\t\t\ts, err := brook.NewBrookLink(link)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/txthinking/brook/blob/5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8/cli/brook/main.go#L462-L498","documentation":"The socks5 subcommand needs a concrete IP address (not just a port) to bind/advertise its UDP relay. After applying the --socks5ServerIP override, if the host portion h is still empty the command aborts, because a port-only address cannot host a socks5 UDP ASSOC. The message suggests choosing loopback, LAN, or another IP explicitly.","triggerScenarios":"Running `brook socks5 --socks5 :1080` (or a value without a host) without --socks5ServerIP, so h derived from --socks5 remains empty after the `c.String(\"socks5ServerIP\")` override at cli/brook/main.go:480.","commonSituations":"Users accustomed to port-only listening for TCP assume :1080 suffices; container setups where the LAN IP is unknown; configs copied from TCP-only examples.","solutions":["Set --socks5ServerIP to an explicit IP, e.g. --socks5ServerIP 127.0.0.1 or your LAN IP","Or specify the full listen address with host: --socks5 127.0.0.1:1080","Use 0.0.0.0 if you truly want all interfaces — any concrete IP is accepted, only empty is rejected"],"exampleFix":"// before\nbrook socks5 --socks5 :1080 --password x\n// after\nbrook socks5 --socks5 127.0.0.1:1080 --socks5ServerIP 127.0.0.1 --password x","handlingStrategy":"validation","validationCode":"# before running, ensure a host is present\n[[ \"$socks5_addr\" == *:*\"\" ]] && host=\"${socks5_addr%%:*}\" || host=\"$socks5ServerIP\"\n[ -n \"$host\" ] || { echo \"socks5 server needs an explicit IP for UDP; set --socks5ServerIP\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit --socks5ServerIP (127.0.0.1, LAN IP, or 0.0.0.0) in deployments","Never use port-only listen addresses for the socks5 subcommand","In containers, resolve and pass the pod/LAN IP at startup rather than relying on defaults"],"tags":["cli","go","socks5","udp","brook"],"backgroundTag":"missing-required-argument","analyzedSha":"5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8","analyzedAt":"2026-09-06T04:35:00.432Z","contentChangedAt":"2026-09-06T04:35:00.432Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}