{"record":{"id":"3642940f637fa2ce","repo":"txthinking/brook","slug":"looks-like-you-want-create-socks5-from-a-socks5-y","errorCode":null,"errorMessage":"Looks like you want create socks5 from a socks5, you may want $ brook socks5tohttp?","messagePattern":"Looks like you want create socks5 from a socks5, you may want \\$ brook socks5tohttp\\?","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/brook/main.go","lineNumber":493,"sourceCode":"\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}\n\t\t\t\terr = s.PrepareSocks5Server(c.String(\"socks5\"), h, c.Int(\"tcpTimeout\"), c.Int(\"udpTimeout\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tg.Add(&runnergroup.Runner{\n\t\t\t\t\tStart: func() error {\n\t\t\t\t\t\treturn s.ListenAndServe()\n\t\t\t\t\t},\n\t\t\t\t\tStop: func() error {\n\t\t\t\t\t\treturn s.Shutdown()\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tif c.String(\"http\") != \"\" {","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/txthinking/brook/blob/5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8/cli/brook/main.go#L475-L511","documentation":"The socks5 subcommand is meant to wrap a non-socks5 upstream (a brook link, ss link, etc.) and expose it as a local socks5 server. brook.ParseLink returns kind == \"socks5\" for a socks5:// link, and since wrapping socks5-in-socks5 is meaningless (and socks5tohttp exists for the reverse direction), main.go:493 rejects it with this guidance error.","triggerScenarios":"Running `brook socks5 --from socks5://user:pass@host:1080 ...` — i.e. passing a link whose parsed scheme/kind is \"socks5\" into the socks5 subcommand.","commonSituations":"Users who already have a socks5 server and want a local proxy copy-paste it as the upstream link; automation pipelines that generically feed proxy URIs without checking the scheme; confusion between the socks5 (server wrapper) and socks5tohttp subcommands.","solutions":["If the goal is a local socks5 for an existing socks5 server, just use the socks5 server directly — no wrapping needed","If you wanted HTTP from socks5, run `brook socks5tohttp --from socks5://...` as the message suggests","Use a non-socks5 link (brook:// or ss://) as the --from value for this subcommand"],"exampleFix":"// before\nbrook socks5 --from socks5://user:pass@1.2.3.4:1080\n// after\nbrook socks5tohttp --from socks5://user:pass@1.2.3.4:1080\n// or, for a brook upstream:\nbrook socks5 --from brook://1.2.3.4:9999","handlingStrategy":"validation","validationCode":"case \"${from%%://*}\" in\n  socks5) echo \"upstream is already socks5; use it directly or run brook socks5tohttp\" >&2; exit 1 ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the URI scheme of upstream links before feeding them to the socks5 subcommand","Remember the mapping: brook/ss links -> `brook socks5` wrapper; socks5 -> `brook socks5tohttp` for HTTP output","Validate generated proxy URIs in automation to avoid nesting socks5 inside socks5"],"tags":["cli","go","socks5","invalid-upstream","brook"],"backgroundTag":"incompatible-source-type","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"}