pingap_proxy/lib.rs
1// Copyright 2024-2025 Tree xie.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use ahash::AHashMap;
16use std::sync::Arc;
17
18mod headers;
19mod server;
20mod server_conf;
21#[cfg(feature = "tracing")]
22mod tracing;
23static LOG_TARGET: &str = "pingap::proxy";
24
25pub(crate) use headers::*;
26pub use server::*;
27pub use server_conf::*;
28#[allow(unused_imports)]
29#[cfg(feature = "tracing")]
30pub(crate) use tracing::*;
31
32pub trait ServerLocationsProvider: Send + Sync {
33 /// Get the locations of the server
34 ///
35 /// # Arguments
36 /// * `name` - The name of the server to get
37 ///
38 /// # Returns
39 /// * `Option<Arc<Vec<String>>>` - The locations of the server if found, None otherwise
40 fn get(&self, name: &str) -> Option<Arc<Vec<String>>>;
41}
42pub type ServerLocations = AHashMap<String, Arc<Vec<String>>>;