jni设置dns

This commit is contained in:
lubeilin
2024-04-23 13:56:25 +08:00
parent 3272f3cdca
commit 441e374563
2 changed files with 10 additions and 3 deletions
@@ -51,7 +51,7 @@ public class Config {
*/
private String server;
/**
* 服务端地址
* dns地址
*/
private String[] dns;
/**
@@ -194,6 +194,14 @@ public class Config {
this.server = server;
}
public String[] getDns() {
return dns;
}
public void setDns(String[] dns) {
this.dns = dns;
}
public String[] getStunServer() {
return stunServer;
}
+1 -2
View File
@@ -1,4 +1,3 @@
use std::net::ToSocketAddrs;
use std::str::FromStr;
use jni::errors::Error;
@@ -21,7 +20,7 @@ pub fn new_config(env: &mut JNIEnv, config: JObject) -> Result<Config, Error> {
let password = to_string(env, &config, "password")?;
let server_address_str = to_string_not_null(env, &config, "server")?;
let stun_server = to_string_array_not_null(env, &config, "stunServer")?;
let dns = to_string_array_not_null(env, &config, "dns")?;
let dns = to_string_array(env, &config, "dns")?.unwrap_or_else(|| vec![]);
let cipher_model = to_string_not_null(env, &config, "cipherModel")?;
let punch_model = to_string(env, &config, "punchModel")?;
let mtu = to_integer(env, &config, "mtu")?.map(|v| v as u32);