{"record":{"id":"2505255aa3c4647d","repo":"shadow1ng/fscan","slug":"socks5-unsupported-address-type-d","errorCode":null,"errorMessage":"socks5_unsupported_address_type: %d","messagePattern":"socks5_unsupported_address_type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/socks5proxy.go","lineNumber":248,"sourceCode":"\t\taddr := make([]byte, domainLen+2)\n\t\tif _, err := io.ReadFull(clientConn, addr); err != nil {\n\t\t\treturn nil, 0, fmt.Errorf(\"%s\", i18n.GetText(\"domain_length_invalid\"))\n\t\t}\n\t\ttargetHost = string(addr[:domainLen])\n\t\ttargetPort = int(addr[domainLen])<<8 + int(addr[domainLen+1])\n\tcase 0x04: // IPv6\n\t\taddr := make([]byte, 18)\n\t\tif _, err := io.ReadFull(clientConn, addr); err != nil {\n\t\t\treturn nil, 0, fmt.Errorf(\"%s\", i18n.GetText(\"ipv6_address_invalid\"))\n\t\t}\n\t\t// IPv6地址解析（简化实现）\n\t\ttargetHost = net.IP(addr[:16]).String()\n\t\ttargetPort = int(addr[16])<<8 + int(addr[17])\n\tdefault:\n\t\t// 发送不支持的地址类型响应\n\t\tresponse := []byte{0x05, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n\t\t_, _ = clientConn.Write(response)\n\t\treturn nil, 0, fmt.Errorf(i18n.GetText(\"socks5_unsupported_address_type\")+\": %d\", addrType)\n\t}\n\tif targetPort == 0 {\n\t\treturn nil, 0, fmt.Errorf(\"%s\", i18n.GetText(\"socks5_invalid_request\"))\n\t}\n\n\t// 连接目标服务器\n\ttargetAddr := net.JoinHostPort(targetHost, strconv.Itoa(int(targetPort)))\n\ttargetConn, err := net.DialTimeout(\"tcp\", targetAddr, 10*time.Second)\n\tif err != nil {\n\t\t// 发送连接失败响应\n\t\tresponse := []byte{0x05, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n\t\t_, _ = clientConn.Write(response)\n\t\treturn nil, 0, fmt.Errorf(\"%s: %w\", i18n.GetText(\"socks5_target_connect_failed\"), err)\n\t}\n\n\t// 获取本地监听端口（从targetConn获取）\n\tlocalAddr, ok := targetConn.LocalAddr().(*net.TCPAddr)\n\tif !ok {","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/socks5proxy.go#L230-L266","documentation":"Guard in the address-type switch of handleSocks5Request: header[3] (ATYP) is none of 0x01 (IPv4), 0x03 (domain), or 0x04 (IPv6). The request is rejected after sending the SOCKS5 0x08 'address type not supported' reply, because the target address format is unrecognizable.","triggerScenarios":"Thrown at plugins/local/socks5proxy.go:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Update the client to use a standard SOCKS5 address type (IPv4, domain, or IPv6)","Add support for the missing ATYP if a legitimate client requires it","Log the offending ATYP value to identify misbehaving clients"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}