mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-06 09:48:58 +00:00
feat(ui): add ACL graphical configuration interface (#1815)
This commit is contained in:
@@ -825,6 +825,12 @@ impl NetworkConfig {
|
||||
flags.encryption_algorithm = encryption_algorithm;
|
||||
}
|
||||
|
||||
if let Some(acl) = self.acl.as_ref()
|
||||
&& !acl.is_empty()
|
||||
{
|
||||
cfg.set_acl(Some(acl.clone()));
|
||||
}
|
||||
|
||||
if let Some(data_compress_algo) = self.data_compress_algo {
|
||||
if data_compress_algo < 1 {
|
||||
flags.data_compress_algo = 1;
|
||||
@@ -964,6 +970,8 @@ impl NetworkConfig {
|
||||
(flags.instance_recv_bps_limit != u64::MAX).then_some(flags.instance_recv_bps_limit);
|
||||
result.enable_private_mode = Some(flags.private_mode);
|
||||
|
||||
result.acl = config.get_acl();
|
||||
|
||||
if flags.relay_network_whitelist == "*" {
|
||||
result.enable_relay_network_whitelist = Some(false);
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,26 @@ use std::fmt::Display;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/acl.rs"));
|
||||
|
||||
impl Acl {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.acl_v1.as_ref().map(|v1| v1.is_empty()).unwrap_or(true)
|
||||
}
|
||||
}
|
||||
|
||||
impl AclV1 {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
let has_chains = !self.chains.is_empty();
|
||||
let has_groups = self.group.as_ref().map(|g| !g.is_empty()).unwrap_or(false);
|
||||
!has_chains && !has_groups
|
||||
}
|
||||
}
|
||||
|
||||
impl GroupInfo {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.declares.is_empty() && self.members.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for ConnTrackEntry {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let src = self
|
||||
|
||||
@@ -3,6 +3,7 @@ syntax = "proto3";
|
||||
import "common.proto";
|
||||
import "peer_rpc.proto";
|
||||
import "api_instance.proto";
|
||||
import "acl.proto";
|
||||
|
||||
package api.manage;
|
||||
|
||||
@@ -83,7 +84,7 @@ message NetworkConfig {
|
||||
optional bool disable_tcp_hole_punching = 54;
|
||||
|
||||
common.SecureModeConfig secure_mode = 55;
|
||||
reserved 56;
|
||||
optional acl.Acl acl = 56;
|
||||
optional string credential_file = 57;
|
||||
optional bool lazy_p2p = 58;
|
||||
optional bool need_p2p = 59;
|
||||
|
||||
Reference in New Issue
Block a user