suspend fun flatten()

in core/src/main/java/com/github/shadowsocks/acl/Acl.kt [153:169]


    suspend fun flatten(depth: Int, connect: suspend (URL) -> URLConnection): Acl {
        if (depth > 0) for (url in urls.asIterable()) {
            val child = Acl().fromReader(connect(url).getInputStream().bufferedReader(), bypass)
            child.flatten(depth - 1, connect)
            if (bypass != child.bypass) {
                Timber.w("Imported network ACL has a conflicting mode set. " +
                        "This will probably not work as intended. URL: $url")
                child.subnets.clear() // subnets for the different mode are discarded
                child.bypass = bypass
            }
            for (item in child.bypassHostnames.asIterable()) bypassHostnames.add(item)
            for (item in child.proxyHostnames.asIterable()) proxyHostnames.add(item)
            for (item in child.subnets.asIterable()) subnets.add(item)
        }
        urls.clear()
        return this
    }