Android 版的代码是在哪里读取配置来进行设置的

默认的配置是这样的

data class Profile(
        @PrimaryKey(autoGenerate = true)
        var id: Long = 0,
        var name: String? = "",
        var host: String = "198.199.101.152",
        var remotePort: Int = 8388,
        var password: String = "u1rRWTssNv0p",
        var method: String = "aes-256-cfb",
        var route: String = "all",
        var remoteDns: String = "8.8.8.8",
        var proxyApps: Boolean = false,
        var bypass: Boolean = false,
        var udpdns: Boolean = false,
        var ipv6: Boolean = true,
        var individual: String = "",
        var tx: Long = 0,
        var rx: Long = 0,
        var userOrder: Long = 0,
        var plugin: String? = null,
        var udpFallback: Long? = null,

        @Ignore // not persisted in db, only used by direct boot
        var dirty: Boolean = false
)

VpnService的配置代码是这样的:

private suspend fun startVpn(): FileDescriptor {
        val profile = data.proxy!!.profile
        val builder = Builder()
                .setConfigureIntent(Core.configureIntent(this))
                .setSession(profile.formattedName)
                .setMtu(VPN_MTU)
                .addAddress(PRIVATE_VLAN4_CLIENT, 30)
                .addDnsServer(PRIVATE_VLAN4_ROUTER)

        if (profile.ipv6) {
            builder.addAddress(PRIVATE_VLAN6_CLIENT, 126)
            builder.addRoute("::", 0)
        }

        if (profile.proxyApps) {
            val me = packageName
            profile.individual.split('\n')
                    .filter { it != me }
                    .forEach {
                        try {
                            if (profile.bypass) builder.addDisallowedApplication(it)
                            else builder.addAllowedApplication(it)
                        } catch (ex: PackageManager.NameNotFoundException) {
                            printLog(ex)
                        }
                    }
            if (!profile.bypass) builder.addAllowedApplication(me)
        }

        when (profile.route) {
            Acl.ALL, Acl.BYPASS_CHN, Acl.CUSTOM_RULES -> builder.addRoute("0.0.0.0", 0)
            else -> {
                resources.getStringArray(R.array.bypass_private_route).forEach {
                    val subnet = Subnet.fromString(it)!!
                    builder.addRoute(subnet.address.hostAddress, subnet.prefixSize)
                }
                builder.addRoute(PRIVATE_VLAN4_ROUTER, 32)
            }
        }

        active = true   // possible race condition here?
        if (Build.VERSION.SDK_INT >= 22) builder.setUnderlyingNetworks(underlyingNetworks)

        val conn = builder.establish() ?: throw NullConnectionException()
        this.conn = conn
        val fd = conn.fd

        val cmd = arrayListOf(File(applicationInfo.nativeLibraryDir, Executable.TUN2SOCKS).absolutePath,
                "--netif-ipaddr", PRIVATE_VLAN4_ROUTER,
                "--netif-netmask", "255.255.255.0",
                "--socks-server-addr", "${DataStore.listenAddress}:${DataStore.portProxy}",
                "--tunfd", fd.toString(),
                "--tunmtu", VPN_MTU.toString(),
                "--sock-path", "sock_path",
                "--dnsgw", "127.0.0.1:${DataStore.portLocalDns}",
                "--loglevel", "3")
        if (profile.ipv6) {
            cmd += "--netif-ip6addr"
            cmd += PRIVATE_VLAN6_ROUTER
        }
        cmd += "--enable-udprelay"
        data.processes!!.start(cmd, onRestartCallback = {
            try {
                sendFd(conn.fileDescriptor)
            } catch (e: ErrnoException) {
                stopRunner(false, e.message)
            }
        })
        return conn.fileDescriptor
    }

找不到在哪里设置的hostport啊,也没看到哪里调用了shadowsocks的代码啊,重点是不知道怎么读取ACL文件来进行分流设置的,公司项目需要用到分流,看了代码也实在弄不明白了,懂的帮个忙啊
Help!

按我的理解是,VpnService接收到了Android应用的请求流量,然后转发到ssr上了

按我的理解是,VpnService接收到了Android应用的请求流量,然后转发到ssr上了

怎么转发,可以说一下相关的代码在哪里吗

把它的jni复制到我的项目一堆错:

Build command failed.
Error while executing process /home/xxxx/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/Application.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/home/xxxx/AndroidStudioProjects/NaviteTest/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/xxxx/AndroidStudioProjects/NaviteTest/app/build/intermediates/ndkBuild/debug/lib -j20 /home/xxxx/AndroidStudioProjects/NaviteTest/app/build/intermediates/ndkBuild/debug/obj/local/x86/libss-local.so}
[x86] Compile        : ss-local <= local.c
[x86] Compile        : ss-local <= cache.c
[x86] Compile        : ss-local <= udprelay.c
[x86] Compile        : ss-local <= utils.c
[x86] Compile        : ss-local <= netutils.c
[x86] Compile        : ss-local <= json.c
[x86] Compile        : ss-local <= jconf.c
[x86] Compile        : ss-local <= acl.c
[x86] Compile        : ss-local <= http.c
[x86] Compile        : ss-local <= tls.c
[x86] Compile        : ss-local <= rule.c
[x86] Compile        : ss-local <= crypto.c
[x86] Compile        : ss-local <= aead.c
[x86] Compile        : ss-local <= stream.c
[x86] Compile        : ss-local <= base64.c
[x86] Compile        : ss-local <= plugin.c
[x86] Compile        : ss-local <= ppbloom.c
[x86] Compile        : ss-local <= android.c
[x86] Compile        : ev <= ev.c
[x86] Compile        : ev <= event.c
[x86] Compile        : mbedtls <= aes.c
[x86] Compile        : mbedtls <= aesni.c
[x86] Compile        : mbedtls <= arc4.c
[x86] Compile        : mbedtls <= asn1parse.c
/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/libev/ev.c:483:48: warning: '/*' within block comment [-Wcomment]
/*#define MIN_INTERVAL  0.00000095367431640625 /* 1/2**20, good till 2200 */
                                               ^
[x86] Compile        : mbedtls <= asn1write.c
[x86] Compile        : mbedtls <= base64.c
[x86] Compile        : mbedtls <= bignum.c
/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/libev/ev.c:1831:31: warning: 'extern' variable has an initializer [-Wextern-initializer]
  EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
                              ^
[x86] Compile        : mbedtls <= blowfish.c
[x86] Compile        : mbedtls <= camellia.c
[x86] Compile        : mbedtls <= ccm.c
[x86] Compile        : mbedtls <= certs.c
[x86] Compile        : mbedtls <= cipher.c
[x86] Compile        : mbedtls <= cipher_wrap.c
[x86] Compile        : mbedtls <= cmac.c
[x86] Compile        : mbedtls <= ctr_drbg.c
[x86] Compile        : mbedtls <= debug.c
[x86] Compile        : mbedtls <= des.c
[x86] Compile        : mbedtls <= dhm.c
/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/libev/ev.c:3878:34: warning: '&' within '|' [-Wbitwise-op-parentheses]
  fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
                       ~~~~~~~~~~^~~~~~~~~~~~~ ~
/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/libev/ev.c:3878:34: note: place parentheses around the '&' expression to silence this warning
  fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
                                 ^
                       (                      )
[x86] Compile        : mbedtls <= ecdh.c
[x86] Compile        : mbedtls <= ecdsa.c
[x86] Compile        : mbedtls <= ecjpake.c
[x86] Compile        : mbedtls <= ecp.c
[x86] Compile        : mbedtls <= ecp_curves.c
[x86] Compile        : mbedtls <= entropy_poll.c
[x86] Compile        : mbedtls <= entropy.c
[x86] Compile        : mbedtls <= error.c
[x86] Compile        : mbedtls <= gcm.c
[x86] Compile        : mbedtls <= havege.c
[x86] Compile        : mbedtls <= hmac_drbg.c
[x86] Compile        : mbedtls <= md2.c
[x86] Compile        : mbedtls <= md4.c
[x86] Compile        : mbedtls <= md5.c
[x86] Compile        : mbedtls <= md.c
[x86] Compile        : mbedtls <= md_wrap.c
[x86] Compile        : mbedtls <= memory_buffer_alloc.c
[x86] Compile        : mbedtls <= net_sockets.c
[x86] Compile        : mbedtls <= oid.c
[x86] Compile        : mbedtls <= padlock.c
[x86] Compile        : mbedtls <= pem.c
[x86] Compile        : mbedtls <= pk.c
[x86] Compile        : mbedtls <= pkcs11.c
[x86] Compile        : mbedtls <= pkcs12.c
[x86] Compile        : mbedtls <= pkcs5.c
[x86] Compile        : mbedtls <= pkparse.c
[x86] Compile        : mbedtls <= pk_wrap.c
[x86] Compile        : mbedtls <= pkwrite.c
[x86] Compile        : mbedtls <= platform.c
[x86] Compile        : mbedtls <= ripemd160.c
[x86] Compile        : mbedtls <= rsa.c
[x86] Compile        : mbedtls <= sha1.c
[x86] Compile        : mbedtls <= sha256.c
[x86] Compile        : mbedtls <= sha512.c
[x86] Compile        : mbedtls <= ssl_cache.c
[x86] Compile        : mbedtls <= ssl_ciphersuites.c
[x86] Compile        : mbedtls <= ssl_cli.c
[x86] Compile        : mbedtls <= ssl_cookie.c
[x86] Compile        : mbedtls <= ssl_srv.c
[x86] Compile        : mbedtls <= ssl_ticket.c
[x86] Compile        : mbedtls <= ssl_tls.c
[x86] Compile        : mbedtls <= threading.c
[x86] Compile        : mbedtls <= timing.c
[x86] Compile        : mbedtls <= version.c
[x86] Compile        : mbedtls <= version_features.c
[x86] Compile        : mbedtls <= x509.c
[x86] Compile        : mbedtls <= x509_create.c
[x86] Compile        : mbedtls <= x509_crl.c
3 warnings generated.
[x86] Compile        : mbedtls <= x509_crt.c
[x86] Compile        : mbedtls <= x509_csr.c
[x86] Compile        : mbedtls <= x509write_crt.c
[x86] Compile        : mbedtls <= x509write_csr.c
[x86] Compile        : mbedtls <= xtea.c
[x86] Compile        : ipset <= general.c
[x86] Compile        : ipset <= assignments.c
[x86] Compile        : ipset <= basics.c
[x86] Compile        : ipset <= bdd-iterator.c
[x86] Compile        : ipset <= expanded.c
[x86] Compile        : ipset <= reachable.c
[x86] Compile        : ipset <= read.c
[x86] Compile        : ipset <= write.c
[x86] Compile        : ipset <= allocation.c
[x86] Compile        : ipset <= inspection.c
[x86] Compile        : ipset <= ipv4_map.c
[x86] Compile        : ipset <= ipv6_map.c
[x86] Compile        : ipset <= storage.c
[x86] Compile        : ipset <= allocation.c
[x86] Compile        : ipset <= inspection.c
[x86] Compile        : ipset <= ipv4_set.c
[x86] Compile        : ipset <= ipv6_set.c
[x86] Compile        : ipset <= iterator.c
[x86] Compile        : ipset <= storage.c
[x86] Compile        : cork <= commands.c
[x86] Compile        : cork <= allocator.c
[x86] Compile        : cork <= error.c
[x86] Compile        : cork <= gc.c
[x86] Compile        : cork <= hash.c
[x86] Compile        : cork <= ip-address.c
[x86] Compile        : cork <= mempool.c
[x86] Compile        : cork <= timestamp.c
[x86] Compile        : cork <= u128.c
[x86] Compile        : cork <= array.c
[x86] Compile        : cork <= bitset.c
[x86] Compile        : cork <= buffer.c
[x86] Compile        : cork <= dllist.c
[x86] Compile        : cork <= file-stream.c
[x86] Compile        : cork <= hash-table.c
[x86] Compile        : cork <= managed-buffer.c
[x86] Compile        : cork <= ring-buffer.c
[x86] Compile        : cork <= slice.c
[x86] Compile        : cork <= directory-walker.c
[x86] Compile        : cork <= env.c
[x86] Compile        : cork <= exec.c
[x86] Compile        : cork <= files.c
[x86] Compile        : cork <= process.c
[x86] Compile        : cork <= subprocess.c
[x86] Compile        : cork <= thread.c
[x86] Compile        : bloom <= bloom.c
[x86] Compile        : bloom <= MurmurHash2.c
[x86] Compile        : sodium <= aead_aes256gcm_aesni.c
[x86] Compile        : sodium <= aead_chacha20poly1305.c
[x86] Compile        : sodium <= aead_xchacha20poly1305.c
[x86] Compile        : sodium <= ed25519_ref10.c
[x86] Compile        : sodium <= core_hchacha20.c
[x86] Compile        : sodium <= core_salsa_ref.c
[x86] Compile        : sodium <= blake2b-compress-ref.c
[x86] Compile        : sodium <= blake2b-ref.c
[x86] Compile        : sodium <= generichash_blake2b.c
[x86] Compile        : sodium <= onetimeauth_poly1305.c
[x86] Compile        : sodium <= poly1305_donna.c
[x86] Compile        : sodium <= crypto_pwhash.c
[x86] Compile        : sodium <= argon2-core.c
[x86] Compile        : sodium <= argon2.c
[x86] Compile        : sodium <= argon2-encoding.c
[x86] Compile        : sodium <= argon2-fill-block-ref.c
[x86] Compile        : sodium <= blake2b-long.c
[x86] Compile        : sodium <= pwhash_argon2i.c
[x86] Compile        : sodium <= scalarmult_curve25519.c
[x86] Compile        : sodium <= x25519_ref10.c
[x86] Compile        : sodium <= stream_chacha20.c
[x86] Compile        : sodium <= chacha20_ref.c
[x86] Compile        : sodium <= stream_salsa20.c
[x86] Compile        : sodium <= salsa20_ref.c
[x86] Compile        : sodium <= verify.c
[x86] Compile        : sodium <= randombytes.c
[x86] Compile        : sodium <= randombytes_sysrandom.c
[x86] Compile        : sodium <= core.c
[x86] Compile        : sodium <= runtime.c
[x86] Compile        : sodium <= utils.c
[x86] Compile        : sodium <= version.c
[x86] Compile        : ancillary <= fd_recv.c
[x86] Compile        : ancillary <= fd_send.c
[x86] Compile        : pcre <= pcre_byte_order.c
[x86] Compile        : pcre <= pcre_compile.c
[x86] Compile        : pcre <= pcre_config.c
[x86] Compile        : pcre <= pcre_dfa_exec.c
[x86] Compile        : pcre <= pcre_exec.c
[x86] Compile        : pcre <= pcre_fullinfo.c
[x86] Compile        : pcre <= pcre_get.c
[x86] Compile        : pcre <= pcre_globals.c
[x86] Compile        : pcre <= pcre_jit_compile.c
[x86] Compile        : pcre <= pcre_maketables.c
[x86] Compile        : pcre <= pcre_newline.c
[x86] Compile        : pcre <= pcre_ord2utf8.c
[x86] Compile        : pcre <= pcre_refcount.c
[x86] Compile        : pcre <= pcre_string_utils.c
[x86] Compile        : pcre <= pcre_study.c
[x86] Compile        : pcre <= pcre_tables.c
[x86] Compile        : pcre <= pcre_ucd.c
[x86] Compile        : pcre <= pcre_valid_utf8.c
[x86] Compile        : pcre <= pcre_version.c
[x86] Compile        : pcre <= pcre_xclass.c
[x86] Compile        : pcre <= pcre_chartables.c
[x86] StaticLibrary  : libev.a
[x86] StaticLibrary  : libmbedtls.a
[x86] StaticLibrary  : libipset.a
[x86] StaticLibrary  : libcork.a
[x86] StaticLibrary  : libbloom.a
[x86] StaticLibrary  : libancillary.a
[x86] StaticLibrary  : libpcre.a
[x86] StaticLibrary  : libsodium.a
[x86] Executable     : libss-local.so
/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/shadowsocks-libev/libcork/include/libcork/core/hash.h:352: error: undefined reference to 'posix_memalign'
/home/xxxx/AndroidStudioProjects/NaviteTest/app/src/main/jni/shadowsocks-libev/libcork/include/libcork/core/hash.h:352: error: undefined reference to 'posix_memalign'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/home/xxxx/AndroidStudioProjects/NaviteTest/app/build/intermediates/ndkBuild/debug/obj/local/x86/libss-local.so] Error 1