@@ -43,6 +43,7 @@ object V2rayConfigUtil {
43
43
44
44
val result = getV2rayNonCustomConfig(context, config)
45
45
// Log.d(ANG_PACKAGE, result.content)
46
+ Log .d(ANG_PACKAGE , result.domainPort? : " " )
46
47
return result
47
48
} catch (e: Exception ) {
48
49
e.printStackTrace()
@@ -73,9 +74,10 @@ object V2rayConfigUtil {
73
74
74
75
inbounds(v2rayConfig)
75
76
76
- outbounds(v2rayConfig, outbound)
77
+ val isPlugin = outbound.protocol.equals(EConfigType .HYSTERIA2 .name, true )
78
+ val retOut = outbounds(v2rayConfig, outbound, isPlugin)
77
79
78
- val retMore = moreOutbounds(v2rayConfig, config.subscriptionId)
80
+ val retMore = moreOutbounds(v2rayConfig, config.subscriptionId, isPlugin )
79
81
80
82
routing(v2rayConfig)
81
83
@@ -93,7 +95,7 @@ object V2rayConfigUtil {
93
95
94
96
result.status = true
95
97
result.content = v2rayConfig.toPrettyPrinting()
96
- result.domainPort = if (retMore.first) retMore.second else outbound.getServerAddressAndPort()
98
+ result.domainPort = if (retMore.first) retMore.second else retOut.second
97
99
return result
98
100
}
99
101
@@ -145,8 +147,8 @@ object V2rayConfigUtil {
145
147
return true
146
148
}
147
149
148
- private fun outbounds (v2rayConfig : V2rayConfig , outbound : V2rayConfig .OutboundBean ): Boolean {
149
- if (outbound.protocol.equals( EConfigType . HYSTERIA2 .name, true ) ) {
150
+ private fun outbounds (v2rayConfig : V2rayConfig , outbound : V2rayConfig .OutboundBean , isPlugin : Boolean ): Pair < Boolean , String > {
151
+ if (isPlugin ) {
150
152
val socksPort = 100 + Utils .parseInt(settingsStorage?.decodeString(AppConfig .PREF_SOCKS_PORT ), AppConfig .PORT_SOCKS .toInt())
151
153
val outboundNew = V2rayConfig .OutboundBean (
152
154
mux = null ,
@@ -165,11 +167,11 @@ object V2rayConfigUtil {
165
167
} else {
166
168
v2rayConfig.outbounds.add(outboundNew)
167
169
}
168
- return true
170
+ return Pair ( true , outboundNew.getServerAddressAndPort())
169
171
}
170
172
171
173
val ret = updateOutboundWithGlobalSettings(outbound)
172
- if (! ret) return false
174
+ if (! ret) return Pair ( false , " " )
173
175
174
176
if (v2rayConfig.outbounds.isNotEmpty()) {
175
177
v2rayConfig.outbounds[0 ] = outbound
@@ -178,7 +180,7 @@ object V2rayConfigUtil {
178
180
}
179
181
180
182
updateOutboundFragment(v2rayConfig)
181
- return true
183
+ return Pair ( true , outbound.getServerAddressAndPort())
182
184
}
183
185
184
186
private fun fakedns (v2rayConfig : V2rayConfig ) {
@@ -532,10 +534,13 @@ object V2rayConfigUtil {
532
534
return true
533
535
}
534
536
535
- private fun moreOutbounds (v2rayConfig : V2rayConfig , subscriptionId : String ): Pair <Boolean , String > {
537
+ private fun moreOutbounds (v2rayConfig : V2rayConfig , subscriptionId : String , isPlugin : Boolean ): Pair <Boolean , String > {
536
538
val returnPair = Pair (false , " " )
537
539
var domainPort: String = " "
538
540
541
+ if (isPlugin) {
542
+ return returnPair
543
+ }
539
544
// fragment proxy
540
545
if (settingsStorage?.decodeBool(AppConfig .PREF_FRAGMENT_ENABLED , false ) == true ) {
541
546
return returnPair
0 commit comments