mirror of
https://github.com/MetaCubeX/subconverter.git
synced 2025-11-04 18:19:42 +08:00
Fix wireguard preshared key and keepalive for surge exporter (#840)
* fix wireguard preshared-key for surge * fix wireguard keepalive for surge
This commit is contained in:
parent
ddbc1534aa
commit
0beeeb5d15
@ -723,8 +723,12 @@ std::string generatePeer(Proxy &node, bool client_id_as_reserved = false)
|
|||||||
std::string result;
|
std::string result;
|
||||||
result += "public-key = " + node.PublicKey;
|
result += "public-key = " + node.PublicKey;
|
||||||
result += ", endpoint = " + node.Hostname + ":" + std::to_string(node.Port);
|
result += ", endpoint = " + node.Hostname + ":" + std::to_string(node.Port);
|
||||||
|
if(!node.PreSharedKey.empty())
|
||||||
|
result += ", preshared-key = " + node.PreSharedKey;
|
||||||
if(!node.AllowedIPs.empty())
|
if(!node.AllowedIPs.empty())
|
||||||
result += ", allowed-ips = \"" + node.AllowedIPs + "\"";
|
result += ", allowed-ips = \"" + node.AllowedIPs + "\"";
|
||||||
|
if(node.KeepAlive > 0)
|
||||||
|
result += ", keepalive = " + std::to_string(node.KeepAlive);
|
||||||
if(!node.ClientId.empty())
|
if(!node.ClientId.empty())
|
||||||
{
|
{
|
||||||
if(client_id_as_reserved)
|
if(client_id_as_reserved)
|
||||||
@ -927,14 +931,10 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
ini.set(real_section, "self-ip", x.SelfIP);
|
ini.set(real_section, "self-ip", x.SelfIP);
|
||||||
if(!x.SelfIPv6.empty())
|
if(!x.SelfIPv6.empty())
|
||||||
ini.set(real_section, "self-ip-v6", x.SelfIPv6);
|
ini.set(real_section, "self-ip-v6", x.SelfIPv6);
|
||||||
if(!x.PreSharedKey.empty())
|
|
||||||
ini.set(real_section, "preshared-key", x.PreSharedKey);
|
|
||||||
if(!x.DnsServers.empty())
|
if(!x.DnsServers.empty())
|
||||||
ini.set(real_section, "dns-server", join(x.DnsServers, ","));
|
ini.set(real_section, "dns-server", join(x.DnsServers, ","));
|
||||||
if(x.Mtu > 0)
|
if(x.Mtu > 0)
|
||||||
ini.set(real_section, "mtu", std::to_string(x.Mtu));
|
ini.set(real_section, "mtu", std::to_string(x.Mtu));
|
||||||
if(x.KeepAlive > 0)
|
|
||||||
ini.set(real_section, "keepalive", std::to_string(x.KeepAlive));
|
|
||||||
ini.set(real_section, "peer", "(" + generatePeer(x) + ")");
|
ini.set(real_section, "peer", "(" + generatePeer(x) + ")");
|
||||||
break;
|
break;
|
||||||
case ProxyType::Hysteria2:
|
case ProxyType::Hysteria2:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user