mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 10:15:31 +00:00
aquatic_http access list: add config, state field, initial load
This commit is contained in:
parent
b8b9a9839a
commit
4fa199a1e0
3 changed files with 18 additions and 0 deletions
|
|
@ -7,6 +7,8 @@ use mio::{Poll, Waker};
|
|||
use parking_lot::Mutex;
|
||||
use privdrop::PrivDrop;
|
||||
|
||||
use aquatic_common::access_list::AccessListMode;
|
||||
|
||||
pub mod common;
|
||||
pub mod config;
|
||||
pub mod handler;
|
||||
|
|
@ -22,6 +24,16 @@ pub const APP_NAME: &str = "aquatic_http: HTTP/TLS BitTorrent tracker";
|
|||
pub fn run(config: Config) -> anyhow::Result<()> {
|
||||
let state = State::default();
|
||||
|
||||
match config.access_list.mode {
|
||||
AccessListMode::Require | AccessListMode::Forbid => {
|
||||
state
|
||||
.access_list
|
||||
.lock()
|
||||
.update_from_path(&config.access_list.path)?;
|
||||
}
|
||||
AccessListMode::Ignore => {}
|
||||
}
|
||||
|
||||
start_workers(config.clone(), state.clone())?;
|
||||
|
||||
loop {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue