mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
aquatic_udp: update access list at startup, exit on failure
This commit is contained in:
parent
f370dac330
commit
9893341622
2 changed files with 8 additions and 1 deletions
1
TODO.md
1
TODO.md
|
|
@ -1,7 +1,6 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
* access lists:
|
* access lists:
|
||||||
* disallow any activity until access list is loaded / load it at startup
|
|
||||||
* test functionality
|
* test functionality
|
||||||
* rename Allow to Require?
|
* rename Allow to Require?
|
||||||
* serde-rename AccessListTypes to lowercase
|
* serde-rename AccessListTypes to lowercase
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ use std::thread::Builder;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
use aquatic_common::AccessListType;
|
||||||
use crossbeam_channel::unbounded;
|
use crossbeam_channel::unbounded;
|
||||||
use privdrop::PrivDrop;
|
use privdrop::PrivDrop;
|
||||||
|
|
||||||
|
|
@ -23,6 +24,13 @@ pub const APP_NAME: &str = "aquatic_udp: UDP BitTorrent tracker";
|
||||||
pub fn run(config: Config) -> ::anyhow::Result<()> {
|
pub fn run(config: Config) -> ::anyhow::Result<()> {
|
||||||
let state = State::default();
|
let state = State::default();
|
||||||
|
|
||||||
|
match config.access_list.list_type {
|
||||||
|
AccessListType::Allow | AccessListType::Deny => {
|
||||||
|
state.access_list.lock().update_from_path(&config.access_list.path)?;
|
||||||
|
},
|
||||||
|
AccessListType::Ignore => {},
|
||||||
|
}
|
||||||
|
|
||||||
let num_bound_sockets = start_workers(config.clone(), state.clone())?;
|
let num_bound_sockets = start_workers(config.clone(), state.clone())?;
|
||||||
|
|
||||||
if config.privileges.drop_privileges {
|
if config.privileges.drop_privileges {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue