Skip to content

Commit

Permalink
Extract server functions from main.rs to lib.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
sqrtsanta committed Sep 13, 2024
1 parent 0c08d95 commit b65c844
Show file tree
Hide file tree
Showing 6 changed files with 780 additions and 763 deletions.
70 changes: 35 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ brew install tonarino/innernet/innernet
cargo install --git https://github.com/tonarino/innernet --tag v1.6.1 client

# to install innernet-server:
cargo install --git https://github.com/tonarino/innernet --tag v1.6.1 server
cargo install --git https://github.com/tonarino/innernet --tag v1.6.1 innernet-server
```

Note that you'll be responsible for updating manually.
Expand Down
5 changes: 4 additions & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ description = "A server to coordinate innernet networks."
edition = "2021"
homepage = "https://github.com/tonarino/innernet"
license = "MIT"
name = "server"
name = "innernet-server"
publish = false
readme = "README.md"
repository = "https://github.com/tonarino/innernet"
version = "1.6.1"

[lib]
path = "src/lib.rs"

[[bin]]
name = "innernet-server"
path = "src/main.rs"
Expand Down
10 changes: 7 additions & 3 deletions server/src/initialize.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use crate::*;
use anyhow::anyhow;
use crate::{
db::{self, DatabaseCidr, DatabasePeer},
ConfigFile, Interface, Path, ServerConfig,
};
use anyhow::{anyhow, Error};
use clap::Parser;
use db::DatabaseCidr;
use colored::Colorize;
use dialoguer::{theme::ColorfulTheme, Input};
use indoc::printdoc;
use ipnet::IpNet;
Expand All @@ -10,6 +13,7 @@ use rusqlite::{params, Connection};
use shared::{
prompts, CidrContents, Endpoint, IpNetExt, PeerContents, PERSISTENT_KEEPALIVE_INTERVAL_SECS,
};
use std::net::{IpAddr, SocketAddr};
use wireguard_control::KeyPair;

fn create_database<P: AsRef<Path>>(
Expand Down
Loading

0 comments on commit b65c844

Please sign in to comment.