fix(normalsub): conditionally generate sing-box obfs config

This commit is contained in:
ReturnFI
2025-12-25 17:10:42 +00:00
parent ff0a218c63
commit ea4014bceb

View File

@ -308,15 +308,11 @@ class SingboxConfigGenerator:
print(f"Error during Singbox config generation from URI: {e}, URI: {uri}") print(f"Error during Singbox config generation from URI: {e}, URI: {uri}")
return None return None
return { outbound_config = {
"type": "hysteria2", "type": "hysteria2",
"tag": unquote(parsed_url.fragment), "tag": unquote(parsed_url.fragment),
"server": server, "server": server,
"server_port": server_port, "server_port": server_port,
"obfs": {
"type": "salamander",
"password": obfs_password
},
"password": final_password, "password": final_password,
"tls": { "tls": {
"enabled": True, "enabled": True,
@ -325,6 +321,14 @@ class SingboxConfigGenerator:
} }
} }
if obfs_password:
outbound_config["obfs"] = {
"type": "salamander",
"password": obfs_password
}
return outbound_config
def combine_configs(self, all_uris: List[str], username: str, fragment: str) -> Optional[Dict[str, Any]]: def combine_configs(self, all_uris: List[str], username: str, fragment: str) -> Optional[Dict[str, Any]]:
if not all_uris: if not all_uris:
return None return None