feat(swqos): add SWQOS provider blacklist configuration
- Add SWQOS_BLACKLIST constant for disabling specific providers - Add SwqosConfig::is_blacklisted() method to check blacklist status - Skip blacklisted providers during client initialization with warning - Remove NextBlock references from README, README_CN and examples - NextBlock is blacklisted by default, can be enabled by removing from SWQOS_BLACKLIST
This commit is contained in:
@@ -58,6 +58,13 @@ lazy_static::lazy_static! {
|
||||
static ref TIP_ACCOUNT_CACHE: RwLock<Vec<String>> = RwLock::new(Vec::new());
|
||||
}
|
||||
|
||||
/// SWQOS provider blacklist configuration
|
||||
/// Providers added here will be disabled even if configured by user
|
||||
/// To enable a provider, remove it from this list
|
||||
pub const SWQOS_BLACKLIST: &[SwqosType] = &[
|
||||
SwqosType::NextBlock, // NextBlock is disabled by default
|
||||
];
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum TradeType {
|
||||
Create,
|
||||
@@ -187,6 +194,11 @@ impl SwqosConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if current config is in the blacklist
|
||||
pub fn is_blacklisted(&self) -> bool {
|
||||
SWQOS_BLACKLIST.contains(&self.swqos_type())
|
||||
}
|
||||
|
||||
pub fn get_endpoint(swqos_type: SwqosType, region: SwqosRegion, url: Option<String>) -> String {
|
||||
if let Some(custom_url) = url {
|
||||
return custom_url;
|
||||
|
||||
Reference in New Issue
Block a user