{"record":{"id":"81866d62255b4dd0","repo":"shadowsocks/shadowsocks-rust","slug":"invalid-outbound-bind-addr","errorCode":null,"errorMessage":"invalid outbound_bind_addr","messagePattern":"invalid outbound_bind_addr","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2600,"sourceCode":"\n        // SO_MARK\n        #[cfg(any(target_os = \"linux\", target_os = \"android\"))]\n        if let Some(fwmark) = config.outbound_fwmark {\n            nconfig.outbound_fwmark = Some(fwmark);\n        }\n\n        // SO_USER_COOKIE\n        #[cfg(target_os = \"freebsd\")]\n        if let Some(user_cookie) = config.outbound_user_cookie {\n            nconfig.outbound_user_cookie = Some(user_cookie);\n        }\n\n        // Outbound bind() address\n        if let Some(bind_addr) = config.outbound_bind_addr {\n            match bind_addr.parse::<IpAddr>() {\n                Ok(b) => nconfig.outbound_bind_addr = Some(b),\n                Err(..) => {\n                    let err = Error::new(ErrorKind::Invalid, \"invalid outbound_bind_addr\", None);\n                    return Err(err);\n                }\n            }\n        }\n\n        // Bind device / interface\n        nconfig.outbound_bind_interface = config.outbound_bind_interface;\n\n        if let Some(b) = config.outbound_udp_allow_fragmentation {\n            nconfig.outbound_udp_allow_fragmentation = b;\n        }\n\n        if let Some(b) = config.inbound_udp_allow_fragmentation {\n            nconfig.inbound_udp_allow_fragmentation = b;\n        }\n\n        if let Some(proxy_config) = config.outbound_proxy {\n            nconfig.outbound_proxy = proxy_config","sourceCodeStart":2582,"sourceCodeEnd":2618,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2582-L2618","documentation":"The global config allows an outbound_bind_addr that all outbound sockets bind to. It must be a bare IP address; the loader parses it with IpAddr::from_str and returns ErrorKind::Invalid 'invalid outbound_bind_addr' if parsing fails.","triggerScenarios":"Setting `outbound_bind_addr` to a value that fails `parse::<IpAddr>()`: a hostname, a URL, an IP with port (`1.2.3.4:80`), or an interface name like `eth0`.","commonSituations":"Putting a hostname where only an IP is accepted; including a port; trying to bind by interface name; leftover IPv6 with brackets `[::1]`.","solutions":["Set outbound_bind_addr to a plain IPv4 or IPv6 literal, e.g. `0.0.0.0` or `::`","Remove any port or brackets from the value","Resolve hostnames to an IP yourself before placing them in the config","Remove the field if you do not need a specific outbound bind address"],"exampleFix":"// before\n\"outbound_bind_addr\": \"192.168.1.10:0\"\n// after\n\"outbound_bind_addr\": \"192.168.1.10\"","handlingStrategy":"validation","validationCode":"fn validate_outbound_bind_addr(a: &str) -> Result<(), String> {\n    a.parse::<std::net::IpAddr>()\n        .map(|_| ())\n        .map_err(|_| format!(\"outbound_bind_addr must be a bare IP, got: {a}\"))\n}","typeGuard":"fn is_bare_ip(a: &str) -> bool {\n    a.parse::<std::net::IpAddr>().is_ok()\n}","tryCatchPattern":"match bind_addr_str.filter(|a| is_bare_ip(a)) {\n    Some(a) => cfg.outbound_bind_addr = Some(a),\n    None => eprintln!(\"outbound_bind_addr must be a plain IPv4/IPv6 address\"),\n}","preventionTips":["Never put hostnames, ports, or interface names in outbound_bind_addr","Strip brackets from IPv6 literals and drop any :port suffix","Validate the field parses as IpAddr before writing the config","Omit the field unless you specifically need to force a bind address"],"tags":["config","network","shadowsocks","ip-address"],"backgroundTag":"invalid-config-value","analyzedSha":"8eb0f0a65b1d976ab6bed5787327ef86529b0435","analyzedAt":"2026-09-09T12:20:43.168Z","contentChangedAt":"2026-09-09T12:20:43.168Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}