pub struct ActrixConfig {Show 15 fields
pub enable: u8,
pub name: String,
pub env: String,
pub user: Option<String>,
pub group: Option<String>,
pub pid: Option<String>,
pub bind: BindConfig,
pub turn: TurnConfig,
pub location_tag: String,
pub control: ControlConfig,
pub services: ServicesConfig,
pub sqlite_path: PathBuf,
pub actrix_shared_key: String,
pub recording: RecordingConfig,
pub monitoring: MonitoringConfig,
}Expand description
Actrix 辅助服务的主配置结构体
这是系统的核心配置,包含了所有服务的配置信息。 配置文件使用 TOML 格式,支持完整的类型安全加载。
Fields§
§enable: u8Service enable flags (bitmask) - Primary switch for业务服务
This is the primary control mechanism for enabling业务服务。
control 是常驻控制面能力,不受该位掩码控制。
Bit positions(仅业务服务):
- Bit 0 (1): Signaling service
- Bit 1 (2): STUN service
- Bit 2 (4): TURN service
- Bit 3 (8): AIS (Actor Identity Service)
- Bit 4 (16): Signer
Examples:
enable = 31enables all services (1+2+4+8+16=31)enable = 6enables STUN + TURN (2+4=6)enable = 7enables Signaling + STUN + TURN (1+2+4=7)
name: String服务器实例名称
用于标识不同的服务器实例,在集群部署中用于区分节点。 建议使用有意义的命名规则,如:actrix-01, actrix-prod-east-1 等。
env: String运行环境标识
指定当前运行环境,影响安全策略和默认行为:
- “dev”: 开发环境,允许 HTTP,证书检查较松
- “prod”: 生产环境,强制 HTTPS,严格的安全检查
- “test”: 测试环境,用于自动化测试
user: Option<String>运行用户(可选)
指定服务运行的系统用户。服务会在绑定端口后切换到此用户运行, 以提高安全性。留空则保持当前用户。
group: Option<String>运行用户组(可选)
指定服务运行的系统用户组。与 user 配置配合使用。
pid: Option<String>PID 文件路径(可选)
用于存储进程 ID 的文件路径。系统管理工具可以使用此文件 来监控和管理服务进程。
bind: BindConfig网络绑定配置
定义各种网络服务的绑定地址和端口配置。
turn: TurnConfigTURN 服务特定配置
TURN 中继服务的专用配置,包括公网地址、端口范围、认证域等。
location_tag: String位置标签
用于标识服务器的地理位置或逻辑分组,便于运维管理和监控。 例如:us-west-1, office-beijing, edge-node-01
control: ControlConfig控制面配置(常驻)
控制面始终可用,不受 enable 位掩码控制。
services: ServicesConfig服务配置集合
包含所有业务服务的配置,每个服务可以独立配置自己的参数和依赖。 采用服务级别的配置结构,实现高内聚低耦合。
sqlite_path: PathBufSQLite 数据库文件存储目录路径
指定用于存储所有 SQLite 数据库文件的目录路径。
主数据库文件将存储为 {sqlite_path}/actrix.db。
包括 Realm 信息、访问控制列表、nonce 缓存等。
Actrix 内部服务通信共享密钥
用于 Actrix 各服务之间的内部通信认证,如 AIS 与 Signer 之间的通信。 这是系统级的内部认证密钥,仅用于服务间通信,不应用于对外业务。
注意:
- 此密钥仅限 Actrix 内部服务使用
- 不应用于 Realm 业务或外部 API 访问
- 在生产环境中应使用强随机密钥
- 字段名保留 actrix_shared_key 以保持向后兼容
recording: RecordingConfig记录管线配置(日志 + 追踪)
将日志和 OpenTelemetry 追踪配置合并到统一的 recording 段,便于统一管理。
monitoring: MonitoringConfigMonitoring endpoints configuration
Controls authentication for /health and /metrics endpoints.
Supports IP whitelist (CIDR) and/or HTTP Basic Auth (htpasswd file).
When both are configured, a request matching either is allowed (OR logic).
Per-service overrides replace the global config for that service.
Implementations§
Source§impl ActrixConfig
impl ActrixConfig
Sourcepub fn is_signaling_enabled(&self) -> bool
pub fn is_signaling_enabled(&self) -> bool
检查是否启用了信令服务
Service is enabled if the ENABLE_SIGNALING bit is set in the enable bitmask.
Sourcepub fn is_stun_enabled(&self) -> bool
pub fn is_stun_enabled(&self) -> bool
检查是否启用了 STUN 服务
Sourcepub fn is_turn_enabled(&self) -> bool
pub fn is_turn_enabled(&self) -> bool
检查是否启用了 TURN 服务
Sourcepub fn is_ais_enabled(&self) -> bool
pub fn is_ais_enabled(&self) -> bool
检查是否启用了 AIS (AId Issue Service) 身份认证服务
Service is enabled if the ENABLE_AIS bit is set in the enable bitmask.
Sourcepub fn is_signer_enabled(&self) -> bool
pub fn is_signer_enabled(&self) -> bool
检查是否启用了 Signer 密钥服务
Service is enabled if the ENABLE_SIGNER bit is set in the enable bitmask.
Sourcepub fn is_ice_enabled(&self) -> bool
pub fn is_ice_enabled(&self) -> bool
检查是否启用了 ICE 服务(STUN 或 TURN)
Sourcepub fn control_head(&self) -> ControlHead
pub fn control_head(&self) -> ControlHead
当前控制面头类型
Sourcepub fn admin_ui_enabled(&self) -> bool
pub fn admin_ui_enabled(&self) -> bool
Admin UI 是否启用。
Sourcepub fn grpc_api_enabled(&self) -> bool
pub fn grpc_api_enabled(&self) -> bool
NodeAdminService gRPC API 是否启用。
Sourcepub fn superv_managed(&self) -> bool
pub fn superv_managed(&self) -> bool
是否处于 superv 接管模式。
Sourcepub fn get_pid_path(&self) -> Option<String>
pub fn get_pid_path(&self) -> Option<String>
获取 PID 文件路径,如果没有配置则使用默认值
获取 Actrix 内部服务通信共享密钥
此密钥用于 Actrix 系统内部服务间的认证通信, 如 AIS 与 Signer 之间的服务调用。
注意:此密钥仅用于内部服务通信,不应用于对外业务
Sourcepub fn recording_config(&self) -> &RecordingConfig
pub fn recording_config(&self) -> &RecordingConfig
返回记录管线配置引用
Sourcepub fn recording_service_name(&self) -> &str
pub fn recording_service_name(&self) -> &str
返回 OTLP service.name
Sourcepub fn get_filter_level(&self) -> String
pub fn get_filter_level(&self) -> String
获取复合日志/追踪过滤级别,优先使用 RUST_LOG。
With semantic filters, channel targets are set to TRACE so that
all events reach the recording layer (which applies its own gate).
The base level stays info to suppress third-party noise.
Trait Implementations§
Source§impl Clone for ActrixConfig
impl Clone for ActrixConfig
Source§fn clone(&self) -> ActrixConfig
fn clone(&self) -> ActrixConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ActrixConfig
impl Debug for ActrixConfig
Source§impl Default for ActrixConfig
impl Default for ActrixConfig
Source§impl<'de> Deserialize<'de> for ActrixConfig
impl<'de> Deserialize<'de> for ActrixConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ActrixConfig
impl RefUnwindSafe for ActrixConfig
impl Send for ActrixConfig
impl Sync for ActrixConfig
impl Unpin for ActrixConfig
impl UnsafeUnpin for ActrixConfig
impl UnwindSafe for ActrixConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request