mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-18 22:20:06 +08:00
Fix server_ports
This commit is contained in:
parent
8a6cc26c50
commit
0cf1c81933
@ -284,7 +284,7 @@ fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): MutableMap<String, Any
|
||||
if (port != null) {
|
||||
server_port = port
|
||||
} else {
|
||||
server_ports = bean.serverPorts
|
||||
server_ports = hopPortsToSingboxList(bean.serverPorts)
|
||||
}
|
||||
hop_interval = "${bean.hopInterval}s"
|
||||
up_mbps = bean.uploadMbps
|
||||
@ -323,7 +323,7 @@ fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): MutableMap<String, Any
|
||||
if (port != null) {
|
||||
server_port = port
|
||||
} else {
|
||||
server_ports = bean.serverPorts
|
||||
server_ports = hopPortsToSingboxList(bean.serverPorts)
|
||||
}
|
||||
hop_interval = "${bean.hopInterval}s"
|
||||
up_mbps = bean.uploadMbps
|
||||
@ -358,3 +358,14 @@ fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): MutableMap<String, Any
|
||||
else -> mutableMapOf("error_version" to bean.protocolVersion)
|
||||
}
|
||||
}
|
||||
|
||||
fun hopPortsToSingboxList(s: String): List<String> {
|
||||
return s.split(",").mapNotNull {
|
||||
val pRange = it.replace("-", ":")
|
||||
if (pRange.split(":").size == 2) {
|
||||
pRange
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ public class SingBoxOptions {
|
||||
|
||||
public OutboundTLSOptions tls;
|
||||
|
||||
public String server_ports;
|
||||
public List<String> server_ports;
|
||||
|
||||
public String hop_interval;
|
||||
|
||||
@ -575,7 +575,7 @@ public class SingBoxOptions {
|
||||
|
||||
public OutboundTLSOptions tls;
|
||||
|
||||
public String server_ports;
|
||||
public List<String> server_ports;
|
||||
|
||||
public String hop_interval;
|
||||
|
||||
@ -3902,7 +3902,7 @@ public class SingBoxOptions {
|
||||
|
||||
public OutboundTLSOptions tls;
|
||||
|
||||
public String server_ports;
|
||||
public List<String> server_ports;
|
||||
|
||||
public String hop_interval;
|
||||
|
||||
@ -4276,7 +4276,7 @@ public class SingBoxOptions {
|
||||
|
||||
public OutboundTLSOptions tls;
|
||||
|
||||
public String server_ports;
|
||||
public List<String> server_ports;
|
||||
|
||||
public String hop_interval;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user