changed network_id from u32 to string
This commit is contained in:
parent
ec68a54957
commit
6537049e71
@ -1,9 +1,7 @@
|
|||||||
[target.x86_64-unknown-linux-musl]
|
|
||||||
linker = "x86_64-linux-musl-gcc"
|
|
||||||
|
|
||||||
[target.aarch64-unknown-linux-gnu]
|
[target.aarch64-unknown-linux-gnu]
|
||||||
linker = "aarch64-linux-gnu-gcc"
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
ar = "aarch64-linux-gnu-ar"
|
ar = "aarch64-linux-gnu-gcc"
|
||||||
|
strip = { path = "aarch64-linux-gnu-strip" }
|
||||||
# ranlib = "aarch64-linux-gnu-ranlib"
|
# ranlib = "aarch64-linux-gnu-ranlib"
|
||||||
|
|
||||||
[target.x86_64-pc-windows-gnu]
|
[target.x86_64-pc-windows-gnu]
|
||||||
|
|||||||
570
Cargo.lock
generated
570
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
24
Cargo.toml
24
Cargo.toml
@ -31,3 +31,27 @@ wintun = "0.4.0"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
tun = []
|
tun = []
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cargo-deb = "3.6.2"
|
||||||
|
|
||||||
|
[package.metadata.deb]
|
||||||
|
maintainer = "alex <asxalex@163.com>"
|
||||||
|
copyright = "2025, alex"
|
||||||
|
# license-file = ["MIT"]
|
||||||
|
depends = "$auto"
|
||||||
|
|
||||||
|
## assets
|
||||||
|
assets = [
|
||||||
|
## libs and exxcutables
|
||||||
|
["target/release/punchnet", "usr/local/", "755"],
|
||||||
|
["assets/yolov5", "usr/bin/dump-rtsp-jpg", "755"],
|
||||||
|
["assets/libswscale.so.5.7.100", "usr/lib/libswscale.so.5.7.100", "755"],
|
||||||
|
# ["usr/lib/libswscale.so.5", "usr/lib/libswscale.so.5.7.100", "symlink"]
|
||||||
|
# ["usr/lib/libswscale.so", "usr/lib/libswscale.so.5.7.100", "symlink"]
|
||||||
|
]
|
||||||
|
|
||||||
|
maintainer-scripts = "debian"
|
||||||
|
systemd-units = [
|
||||||
|
{ unit-name = "sys-op-api", enable = true }
|
||||||
|
]
|
||||||
14
Makefile
14
Makefile
@ -22,10 +22,16 @@ libtun-so-clang:
|
|||||||
cd src/network && clang -fPIC -shared -o libtuntap.so tuntap.c && cd -
|
cd src/network && clang -fPIC -shared -o libtuntap.so tuntap.c && cd -
|
||||||
|
|
||||||
libtun-so:
|
libtun-so:
|
||||||
cd src/network && gcc -fPIC -shared -o libtuntap.so tuntap.c && cd -
|
cd src/network && gcc -fPIC -shared -o libtuntap.so tuntap.c && cp libtuntap.so ../.. && cd -
|
||||||
|
|
||||||
libtun-a:
|
libtun-aarch64-so:
|
||||||
cd src/network && gcc -c tuntap.c && ar rcs libtuntap.a tuntap.o && cd -
|
cd src/network && aarch64-linux-gnu-gcc -fPIC -shared -o libtuntap_aarch64.so tuntap.c && cp libtuntap_aarch64.so ../../libtuntap.so && cd -
|
||||||
|
|
||||||
pack:
|
pack:
|
||||||
tar -czvf punchnet.tar.gz punchnet punchnet.service libtuntap.so install.sh
|
tar -czvf punchnet.tar.gz punchnet punchnet.service libtuntap.so install.sh
|
||||||
|
|
||||||
|
deb-aarch64: libtun-aarch64-so
|
||||||
|
cargo deb --target aarch64-unknown-linux-gnu
|
||||||
|
|
||||||
|
deb: libtun-so
|
||||||
|
cargo deb
|
||||||
11
message.proto
Executable file → Normal file
11
message.proto
Executable file → Normal file
@ -15,7 +15,7 @@ message SDLV6Info {
|
|||||||
|
|
||||||
// 设备网络地址信息
|
// 设备网络地址信息
|
||||||
message SDLDevAddr {
|
message SDLDevAddr {
|
||||||
uint32 network_id = 1;
|
string network_id = 1;
|
||||||
bytes mac = 2;
|
bytes mac = 2;
|
||||||
uint32 net_addr = 3;
|
uint32 net_addr = 3;
|
||||||
uint32 net_bit_len = 4;
|
uint32 net_bit_len = 4;
|
||||||
@ -33,6 +33,7 @@ message SDLRegisterSuper {
|
|||||||
SDLDevAddr dev_addr = 4;
|
SDLDevAddr dev_addr = 4;
|
||||||
string pub_key = 5;
|
string pub_key = 5;
|
||||||
string token = 6;
|
string token = 6;
|
||||||
|
string network_id = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SDLRegisterSuperAck {
|
message SDLRegisterSuperAck {
|
||||||
@ -106,7 +107,7 @@ message SDLFlows {
|
|||||||
message SDLStunRequest {
|
message SDLStunRequest {
|
||||||
uint32 cookie = 1;
|
uint32 cookie = 1;
|
||||||
string client_id = 2;
|
string client_id = 2;
|
||||||
uint32 network_id = 3;
|
string network_id = 3;
|
||||||
bytes mac = 4;
|
bytes mac = 4;
|
||||||
uint32 ip = 5;
|
uint32 ip = 5;
|
||||||
uint32 nat_type = 6;
|
uint32 nat_type = 6;
|
||||||
@ -118,7 +119,7 @@ message SDLStunReply {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SDLData {
|
message SDLData {
|
||||||
uint32 network_id = 1;
|
string network_id = 1;
|
||||||
bytes src_mac = 2;
|
bytes src_mac = 2;
|
||||||
bytes dst_mac = 3;
|
bytes dst_mac = 3;
|
||||||
bool is_p2p = 4;
|
bool is_p2p = 4;
|
||||||
@ -127,13 +128,13 @@ message SDLData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SDLRegister {
|
message SDLRegister {
|
||||||
uint32 network_id = 1;
|
string network_id = 1;
|
||||||
bytes src_mac = 2;
|
bytes src_mac = 2;
|
||||||
bytes dst_mac = 3;
|
bytes dst_mac = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SDLRegisterAck {
|
message SDLRegisterAck {
|
||||||
uint32 network_id = 1;
|
string network_id = 1;
|
||||||
bytes src_mac = 2;
|
bytes src_mac = 2;
|
||||||
bytes dst_mac = 3;
|
bytes dst_mac = 3;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use sdlan_sn_rs::log;
|
|||||||
|
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
use std::process::exit;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
@ -22,6 +23,12 @@ async fn main() {
|
|||||||
let _guard = log::init_log();
|
let _guard = log::init_log();
|
||||||
|
|
||||||
let cmd = CommandLineInput::from_args();
|
let cmd = CommandLineInput::from_args();
|
||||||
|
if cmd.token.is_empty() && cmd.user_network_id.is_empty() {
|
||||||
|
eprintln!("[ERROR] no token or network_id is specifed. \n\ttry \"punchnet --help\" for detailed usage");
|
||||||
|
exit(-1);
|
||||||
|
// error!("no token or network_id is specified");
|
||||||
|
// exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
// println!("port is {}", cmd.port);
|
// println!("port is {}", cmd.port);
|
||||||
|
|
||||||
@ -41,6 +48,7 @@ async fn main() {
|
|||||||
tos: 0,
|
tos: 0,
|
||||||
local_port: cmd.port,
|
local_port: cmd.port,
|
||||||
token: "test-token".to_owned(),
|
token: "test-token".to_owned(),
|
||||||
|
user_network_id: cmd.user_network_id,
|
||||||
allow_p2p: true,
|
allow_p2p: true,
|
||||||
},
|
},
|
||||||
tx,
|
tx,
|
||||||
|
|||||||
@ -45,6 +45,7 @@ pub async fn run_sdlan(
|
|||||||
|
|
||||||
if let Err(e) = init_edge(
|
if let Err(e) = init_edge(
|
||||||
&args.token,
|
&args.token,
|
||||||
|
&args.user_network_id,
|
||||||
node_conf,
|
node_conf,
|
||||||
args.tos,
|
args.tos,
|
||||||
start_stop_sender,
|
start_stop_sender,
|
||||||
|
|||||||
@ -79,7 +79,8 @@ async fn handle_tcp_message(msg: SdlanTcp) {
|
|||||||
.net_bit_len
|
.net_bit_len
|
||||||
.store(dev.net_bit_len as u8, Ordering::Relaxed);
|
.store(dev.net_bit_len as u8, Ordering::Relaxed);
|
||||||
edge.device.reload_config(&edge.device_config);
|
edge.device.reload_config(&edge.device_config);
|
||||||
edge.network_id.store(dev.network_id, Ordering::Relaxed);
|
*edge.network_id.lock().unwrap() = dev.network_id;
|
||||||
|
// edge.network_id.store(dev.network_id, Ordering::Relaxed);
|
||||||
|
|
||||||
edge.set_authorized(true, aes);
|
edge.set_authorized(true, aes);
|
||||||
send_stun_request(edge).await;
|
send_stun_request(edge).await;
|
||||||
@ -290,6 +291,7 @@ pub async fn async_main(
|
|||||||
let installed_channel = install_channel.to_owned();
|
let installed_channel = install_channel.to_owned();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let token = edge._token.lock().unwrap().clone();
|
let token = edge._token.lock().unwrap().clone();
|
||||||
|
let networkid = edge.network_id.lock().unwrap().clone();
|
||||||
// let edge = get_edge();
|
// let edge = get_edge();
|
||||||
// let edge = get_edge();
|
// let edge = get_edge();
|
||||||
// let token = args.token.clone();
|
// let token = args.token.clone();
|
||||||
@ -310,11 +312,12 @@ pub async fn async_main(
|
|||||||
dev_addr: Some(SdlDevAddr {
|
dev_addr: Some(SdlDevAddr {
|
||||||
mac: Vec::from(edge.device_config.get_mac()),
|
mac: Vec::from(edge.device_config.get_mac()),
|
||||||
net_addr: 0,
|
net_addr: 0,
|
||||||
network_id: 0,
|
network_id: "".to_owned(),
|
||||||
net_bit_len: 0,
|
net_bit_len: 0,
|
||||||
}),
|
}),
|
||||||
pub_key: edge.rsa_pubkey.clone(),
|
pub_key: edge.rsa_pubkey.clone(),
|
||||||
token,
|
token,
|
||||||
|
network_id: networkid,
|
||||||
};
|
};
|
||||||
// debug!("send register super: {:?}", register_super);
|
// debug!("send register super: {:?}", register_super);
|
||||||
let packet_id = match pkt_id {
|
let packet_id = match pkt_id {
|
||||||
@ -448,7 +451,8 @@ async fn send_stun_request(eee: &Node) {
|
|||||||
let req = SdlStunRequest {
|
let req = SdlStunRequest {
|
||||||
cookie: 0,
|
cookie: 0,
|
||||||
client_id: eee.config.node_uuid.clone(),
|
client_id: eee.config.node_uuid.clone(),
|
||||||
network_id: eee.network_id.load(Ordering::Relaxed),
|
network_id: eee.network_id.lock().unwrap().clone(),
|
||||||
|
// network_id: eee.network_id.load(Ordering::Relaxed),
|
||||||
ip: eee.device_config.get_ip(),
|
ip: eee.device_config.get_ip(),
|
||||||
mac: Vec::from(eee.device_config.get_mac()),
|
mac: Vec::from(eee.device_config.get_mac()),
|
||||||
nat_type: eee.get_nat_type() as u32,
|
nat_type: eee.get_nat_type() as u32,
|
||||||
|
|||||||
@ -31,6 +31,7 @@ static EDGE: OnceCell<Node> = OnceCell::new();
|
|||||||
|
|
||||||
pub async fn init_edge(
|
pub async fn init_edge(
|
||||||
token: &str,
|
token: &str,
|
||||||
|
user_network_id: &str,
|
||||||
node_conf: NodeConfig,
|
node_conf: NodeConfig,
|
||||||
tos: u32,
|
tos: u32,
|
||||||
start_stop: Sender<StartStopInfo>,
|
start_stop: Sender<StartStopInfo>,
|
||||||
@ -72,6 +73,7 @@ pub async fn init_edge(
|
|||||||
sock_v4,
|
sock_v4,
|
||||||
sock_multicast,
|
sock_multicast,
|
||||||
token,
|
token,
|
||||||
|
user_network_id,
|
||||||
privatekey,
|
privatekey,
|
||||||
tcp_pong.clone(),
|
tcp_pong.clone(),
|
||||||
start_stop,
|
start_stop,
|
||||||
@ -112,7 +114,7 @@ pub struct StartStopInfo {
|
|||||||
pub struct Node {
|
pub struct Node {
|
||||||
packet_id: AtomicU32,
|
packet_id: AtomicU32,
|
||||||
|
|
||||||
pub network_id: AtomicU32,
|
pub network_id: Mutex<String>,
|
||||||
|
|
||||||
pub tcp_pong: Arc<AtomicU64>,
|
pub tcp_pong: Arc<AtomicU64>,
|
||||||
|
|
||||||
@ -120,6 +122,7 @@ pub struct Node {
|
|||||||
|
|
||||||
// user token info
|
// user token info
|
||||||
pub _token: Mutex<String>,
|
pub _token: Mutex<String>,
|
||||||
|
pub _user_network_id: String,
|
||||||
|
|
||||||
pub device_config: DeviceConfig,
|
pub device_config: DeviceConfig,
|
||||||
pub device: Iface,
|
pub device: Iface,
|
||||||
@ -245,6 +248,8 @@ impl Node {
|
|||||||
multicast_sock: Option<Socket>,
|
multicast_sock: Option<Socket>,
|
||||||
// tcpsock: TCPSocket,
|
// tcpsock: TCPSocket,
|
||||||
token: &str,
|
token: &str,
|
||||||
|
user_network_id: &str,
|
||||||
|
// network: &str,
|
||||||
private: RsaPrivateKey,
|
private: RsaPrivateKey,
|
||||||
tcp_pong: Arc<AtomicU64>,
|
tcp_pong: Arc<AtomicU64>,
|
||||||
start_stop: Sender<StartStopInfo>,
|
start_stop: Sender<StartStopInfo>,
|
||||||
@ -258,8 +263,10 @@ impl Node {
|
|||||||
|
|
||||||
Self {
|
Self {
|
||||||
packet_id: AtomicU32::new(1),
|
packet_id: AtomicU32::new(1),
|
||||||
network_id: AtomicU32::new(0),
|
network_id: Mutex::new("".to_owned()),
|
||||||
|
// network_id: AtomicU32::new(0),
|
||||||
_token: Mutex::new(token.to_owned()),
|
_token: Mutex::new(token.to_owned()),
|
||||||
|
_user_network_id: user_network_id.to_owned(),
|
||||||
|
|
||||||
start_stop_sender: start_stop,
|
start_stop_sender: start_stop,
|
||||||
|
|
||||||
|
|||||||
@ -730,8 +730,10 @@ async fn send_register(
|
|||||||
debug!("skipping register as p2p is disabled");
|
debug!("skipping register as p2p is disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let network_id = eee.network_id.load(Ordering::Relaxed);
|
|
||||||
if network_id == 0 {
|
let network_id = eee.network_id.lock().unwrap().clone();
|
||||||
|
// let network_id = eee.network_id.load(Ordering::Relaxed);
|
||||||
|
if network_id.is_empty() {
|
||||||
error!("not authed");
|
error!("not authed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1020,11 +1022,13 @@ async fn send_register_ack(eee: &Node, orig_sender: &SdlanSock, reg: &SdlRegiste
|
|||||||
debug!("Skipping REGISTER ACK as P2P is disallowed");
|
debug!("Skipping REGISTER ACK as P2P is disallowed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let network_id = eee.network_id.load(Ordering::Relaxed);
|
let network_id = eee.network_id.lock().unwrap().clone();
|
||||||
if network_id == 0 {
|
// let network_id = eee.network_id.load(Ordering::Relaxed);
|
||||||
|
if network_id.is_empty() {
|
||||||
error!("not authed");
|
error!("not authed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let src_mac = reg.src_mac.clone();
|
let src_mac = reg.src_mac.clone();
|
||||||
let ack = SdlRegisterAck {
|
let ack = SdlRegisterAck {
|
||||||
network_id,
|
network_id,
|
||||||
@ -1123,12 +1127,11 @@ pub async fn check_query_peer_info(eee: &'static Node, mac: Mac) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn send_query_peer(eee: &Node, dst_mac: Mac) -> Result<()> {
|
async fn send_query_peer(eee: &Node, dst_mac: Mac) -> Result<()> {
|
||||||
let network_id = eee.network_id.load(Ordering::Relaxed);
|
if !eee.is_authorized() {
|
||||||
|
|
||||||
if network_id == 0 {
|
|
||||||
error!("not authed");
|
error!("not authed");
|
||||||
return Err(SDLanError::NormalError("not connected"));
|
return Err(SDLanError::NormalError("not connected"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let query = SdlQueryInfo {
|
let query = SdlQueryInfo {
|
||||||
dst_mac: Vec::from(dst_mac),
|
dst_mac: Vec::from(dst_mac),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -206,9 +206,10 @@ impl TunTapPacketHandler for Iface {
|
|||||||
error!("failed to encrypt packet request");
|
error!("failed to encrypt packet request");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
let network_id = edge.network_id.lock().unwrap().clone();
|
||||||
let data = SdlData {
|
let data = SdlData {
|
||||||
is_p2p: true,
|
is_p2p: true,
|
||||||
network_id: edge.network_id.load(Ordering::Relaxed),
|
network_id,
|
||||||
ttl: SDLAN_DEFAULT_TTL as u32,
|
ttl: SDLAN_DEFAULT_TTL as u32,
|
||||||
src_mac: Vec::from(edge.device_config.get_mac()),
|
src_mac: Vec::from(edge.device_config.get_mac()),
|
||||||
dst_mac: Vec::from(target),
|
dst_mac: Vec::from(target),
|
||||||
|
|||||||
@ -76,7 +76,7 @@ impl ArpWaitList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let encrypt_key = edge.get_encrypt_key();
|
let encrypt_key = edge.get_encrypt_key();
|
||||||
let network_id = edge.network_id.load(Ordering::Relaxed);
|
let network_id = edge.network_id.lock().unwrap().clone();
|
||||||
|
|
||||||
let src_mac = edge.device_config.get_mac();
|
let src_mac = edge.device_config.get_mac();
|
||||||
let now = get_current_timestamp();
|
let now = get_current_timestamp();
|
||||||
@ -94,7 +94,7 @@ impl ArpWaitList {
|
|||||||
};
|
};
|
||||||
let data = SdlData {
|
let data = SdlData {
|
||||||
is_p2p: true,
|
is_p2p: true,
|
||||||
network_id,
|
network_id: network_id.clone(),
|
||||||
ttl: SDLAN_DEFAULT_TTL as u32,
|
ttl: SDLAN_DEFAULT_TTL as u32,
|
||||||
src_mac: Vec::from(src_mac),
|
src_mac: Vec::from(src_mac),
|
||||||
dst_mac: Vec::from(mac),
|
dst_mac: Vec::from(mac),
|
||||||
|
|||||||
22
src/pb/message.rs
Executable file → Normal file
22
src/pb/message.rs
Executable file → Normal file
@ -21,8 +21,8 @@ pub struct Sdlv6Info {
|
|||||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct SdlDevAddr {
|
pub struct SdlDevAddr {
|
||||||
#[prost(uint32, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
pub network_id: u32,
|
pub network_id: ::prost::alloc::string::String,
|
||||||
#[prost(bytes = "vec", tag = "2")]
|
#[prost(bytes = "vec", tag = "2")]
|
||||||
pub mac: ::prost::alloc::vec::Vec<u8>,
|
pub mac: ::prost::alloc::vec::Vec<u8>,
|
||||||
#[prost(uint32, tag = "3")]
|
#[prost(uint32, tag = "3")]
|
||||||
@ -49,6 +49,8 @@ pub struct SdlRegisterSuper {
|
|||||||
pub pub_key: ::prost::alloc::string::String,
|
pub pub_key: ::prost::alloc::string::String,
|
||||||
#[prost(string, tag = "6")]
|
#[prost(string, tag = "6")]
|
||||||
pub token: ::prost::alloc::string::String,
|
pub token: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag = "7")]
|
||||||
|
pub network_id: ::prost::alloc::string::String,
|
||||||
}
|
}
|
||||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
@ -153,8 +155,8 @@ pub struct SdlStunRequest {
|
|||||||
pub cookie: u32,
|
pub cookie: u32,
|
||||||
#[prost(string, tag = "2")]
|
#[prost(string, tag = "2")]
|
||||||
pub client_id: ::prost::alloc::string::String,
|
pub client_id: ::prost::alloc::string::String,
|
||||||
#[prost(uint32, tag = "3")]
|
#[prost(string, tag = "3")]
|
||||||
pub network_id: u32,
|
pub network_id: ::prost::alloc::string::String,
|
||||||
#[prost(bytes = "vec", tag = "4")]
|
#[prost(bytes = "vec", tag = "4")]
|
||||||
pub mac: ::prost::alloc::vec::Vec<u8>,
|
pub mac: ::prost::alloc::vec::Vec<u8>,
|
||||||
#[prost(uint32, tag = "5")]
|
#[prost(uint32, tag = "5")]
|
||||||
@ -173,8 +175,8 @@ pub struct SdlStunReply {
|
|||||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct SdlData {
|
pub struct SdlData {
|
||||||
#[prost(uint32, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
pub network_id: u32,
|
pub network_id: ::prost::alloc::string::String,
|
||||||
#[prost(bytes = "vec", tag = "2")]
|
#[prost(bytes = "vec", tag = "2")]
|
||||||
pub src_mac: ::prost::alloc::vec::Vec<u8>,
|
pub src_mac: ::prost::alloc::vec::Vec<u8>,
|
||||||
#[prost(bytes = "vec", tag = "3")]
|
#[prost(bytes = "vec", tag = "3")]
|
||||||
@ -189,8 +191,8 @@ pub struct SdlData {
|
|||||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct SdlRegister {
|
pub struct SdlRegister {
|
||||||
#[prost(uint32, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
pub network_id: u32,
|
pub network_id: ::prost::alloc::string::String,
|
||||||
#[prost(bytes = "vec", tag = "2")]
|
#[prost(bytes = "vec", tag = "2")]
|
||||||
pub src_mac: ::prost::alloc::vec::Vec<u8>,
|
pub src_mac: ::prost::alloc::vec::Vec<u8>,
|
||||||
#[prost(bytes = "vec", tag = "3")]
|
#[prost(bytes = "vec", tag = "3")]
|
||||||
@ -199,8 +201,8 @@ pub struct SdlRegister {
|
|||||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct SdlRegisterAck {
|
pub struct SdlRegisterAck {
|
||||||
#[prost(uint32, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
pub network_id: u32,
|
pub network_id: ::prost::alloc::string::String,
|
||||||
#[prost(bytes = "vec", tag = "2")]
|
#[prost(bytes = "vec", tag = "2")]
|
||||||
pub src_mac: ::prost::alloc::vec::Vec<u8>,
|
pub src_mac: ::prost::alloc::vec::Vec<u8>,
|
||||||
#[prost(bytes = "vec", tag = "3")]
|
#[prost(bytes = "vec", tag = "3")]
|
||||||
|
|||||||
@ -7,6 +7,9 @@ pub struct CommandLineInput {
|
|||||||
|
|
||||||
#[structopt(short = "p", long = "port", default_value = "0", help="which port to use")]
|
#[structopt(short = "p", long = "port", default_value = "0", help="which port to use")]
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
|
|
||||||
|
#[structopt(long = "network_id", short = "n", default_value = "", help="specify a networkid")]
|
||||||
|
pub user_network_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(StructOpt, Debug)]
|
#[derive(StructOpt, Debug)]
|
||||||
@ -50,6 +53,9 @@ pub struct CommandLine {
|
|||||||
#[structopt(long = "token", default_value = "0")]
|
#[structopt(long = "token", default_value = "0")]
|
||||||
pub token: String,
|
pub token: String,
|
||||||
|
|
||||||
|
#[structopt(long = "network_id", default_value = "")]
|
||||||
|
pub user_network_id: String,
|
||||||
|
|
||||||
#[structopt(short = "p")]
|
#[structopt(short = "p")]
|
||||||
pub allow_p2p: bool,
|
pub allow_p2p: bool,
|
||||||
|
|
||||||
@ -70,6 +76,7 @@ impl Clone for CommandLine {
|
|||||||
name: self.name.clone(),
|
name: self.name.clone(),
|
||||||
tos: self.tos,
|
tos: self.tos,
|
||||||
token: self.token.clone(),
|
token: self.token.clone(),
|
||||||
|
user_network_id: self.user_network_id.clone(),
|
||||||
allow_p2p: self.allow_p2p,
|
allow_p2p: self.allow_p2p,
|
||||||
nat_server1: self.nat_server1.clone(),
|
nat_server1: self.nat_server1.clone(),
|
||||||
nat_server2: self.nat_server2.clone(),
|
nat_server2: self.nat_server2.clone(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user