mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-15 10:25:40 +00:00
perf: simplify method signatures and reduce clone across multiple files (#1663)
This commit is contained in:
@@ -67,7 +67,7 @@ impl RequestHandler for CatalogRequestHandler {
|
||||
|
||||
pub fn build_authority(domain: &str, records: &[Record]) -> Result<InMemoryAuthority> {
|
||||
let zone = rr::Name::from_str(domain)?;
|
||||
let mut authority = InMemoryAuthority::empty(zone.clone(), ZoneType::Primary, false);
|
||||
let mut authority = InMemoryAuthority::empty(zone, ZoneType::Primary, false);
|
||||
for record in records.iter() {
|
||||
let r = record.try_into()?;
|
||||
authority.upsert_mut(r, 0);
|
||||
|
||||
@@ -73,7 +73,7 @@ impl IpProxy {
|
||||
let tcp_proxy = TcpProxy::new(peer_manager.clone(), NatDstTcpConnector {});
|
||||
let icmp_proxy = IcmpProxy::new(global_ctx.clone(), peer_manager.clone())
|
||||
.with_context(|| "create icmp proxy failed")?;
|
||||
let udp_proxy = UdpProxy::new(global_ctx.clone(), peer_manager.clone())
|
||||
let udp_proxy = UdpProxy::new(global_ctx.clone(), peer_manager)
|
||||
.with_context(|| "create udp proxy failed")?;
|
||||
Ok(IpProxy {
|
||||
tcp_proxy,
|
||||
@@ -551,7 +551,7 @@ impl Instance {
|
||||
let peer_manager = Arc::new(PeerManager::new(
|
||||
RouteAlgoType::Ospf,
|
||||
global_ctx.clone(),
|
||||
peer_packet_sender.clone(),
|
||||
peer_packet_sender,
|
||||
));
|
||||
|
||||
peer_manager.set_allow_loopback_tunnel(false);
|
||||
@@ -617,7 +617,7 @@ impl Instance {
|
||||
self.conn_manager.clone()
|
||||
}
|
||||
|
||||
async fn add_initial_peers(&mut self) -> Result<(), Error> {
|
||||
async fn add_initial_peers(&self) -> Result<(), Error> {
|
||||
for peer in self.global_ctx.config.get_peers().iter() {
|
||||
self.get_conn_manager()
|
||||
.add_connector_by_url(peer.uri.clone())
|
||||
|
||||
@@ -366,7 +366,7 @@ impl VirtualNic {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn create_tun(&mut self) -> Result<tun::platform::Device, Error> {
|
||||
async fn create_tun(&self) -> Result<tun::platform::Device, Error> {
|
||||
let mut config = Configuration::default();
|
||||
config.layer(Layer::L3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user