Skip to content

Commit 667c9ad

Browse files
committed
fix: Update WireGuard configuration loading to support multi-section INI files
1 parent cb6bcd4 commit 667c9ad

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

app/src/main/java/io/nekohasekai/sagernet/fmt/wireguard/WireGuardFmt.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ private const val BASE64_ALPHABET =
1313
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
1414

1515
fun parseWireGuardConfig(conf: String): List<WireGuardBean> {
16-
val ini = Ini(StringReader(conf))
16+
val ini = Ini().apply {
17+
config.isMultiSection = true
18+
load(StringReader(conf))
19+
}
1720
val iface = ini["Interface"] ?: error("Missing 'Interface' selection")
1821
val localAddresses = iface.getAll("Address")
1922
?.flatMap { value -> value.split(',') }

0 commit comments

Comments
 (0)