mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
StartTunnel random subnet and also 80 to 5443 (#3082)
* random subnet and also 80 to 5443 * fix getNext --------- Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
@@ -160,6 +160,16 @@ pub async fn add_subnet(
|
||||
.db
|
||||
.mutate(|db| {
|
||||
let map = db.as_wg_mut().as_subnets_mut();
|
||||
if let Some(s) = map
|
||||
.keys()?
|
||||
.into_iter()
|
||||
.find(|s| s != &subnet && (s.contains(&subnet) || subnet.contains(s)))
|
||||
{
|
||||
return Err(Error::new(
|
||||
eyre!("{subnet} overlaps with existing subnet {s}"),
|
||||
ErrorKind::InvalidRequest,
|
||||
));
|
||||
}
|
||||
map.upsert(&subnet, || {
|
||||
Ok(WgSubnetConfig::new(InternedString::default()))
|
||||
})?
|
||||
|
||||
Reference in New Issue
Block a user