Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring of client code into a library #132

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["server", "client", "hostsfile", "shared", "publicip"]
members = ["server", "cli", "client", "hostsfile", "shared", "publicip"]

[profile.release]
codegen-units = 1
Expand Down
File renamed without changes.
File renamed without changes.
67 changes: 67 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[package]
authors = ["Jake McGinty <[email protected]>"]
description = "A CLI client to manage innernet network interfaces."
edition = "2018"
homepage = "https://github.com/tonarino/innernet"
license = "MIT"
name = "cli"
publish = false
repository = "https://github.com/tonarino/innernet"
version = "1.4.1"

[[bin]]
name = "innernet"
path = "src/main.rs"

[dependencies]
anyhow = "1"
colored = "2"
dialoguer = "0.8"
hostsfile = { path = "../hostsfile" }
indoc = "1"
ipnetwork = { git = "https://github.com/mcginty/ipnetwork" } # pending https://github.com/achanda/ipnetwork/pull/129
lazy_static = "1"
log = "0.4"
regex = { version = "1", default-features = false, features = ["std"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shared = { path = "../shared", default-features = false }
structopt = "0.3"
ureq = { version = "2", default-features = false, features = ["json"] }
wgctrl = { path = "../wgctrl-rs" }

[dev-dependencies]
tempfile = "3"

[package.metadata.deb]
assets = [
["target/release/innernet", "usr/bin/", "755"],
["target/release/innernet", "usr/bin/inn", "755"],
["[email protected]", "usr/lib/systemd/system/", "644"],
["../doc/innernet.8.gz", "usr/share/man/man8/", "644"],
["../doc/innernet.completions.bash", "etc/bash_completion.d/innernet", "644"],
["../doc/innernet.completions.fish", "usr/share/fish/vendor_completions.d/innernet.fish", "644"],
["../doc/innernet.completions.zsh", "usr/share/zsh/site-functions/_innernet", "644"],
]
depends = "libc6, libgcc1, systemd"
extended-description = "innernet client binary for fetching peer information and conducting admin tasks such as adding a new peer."
maintainer = "tonari <[email protected]>"
name = "innernet"
priority = "optional"
section = "net"

[package.metadata.rpm]
package = "innernet"

[package.metadata.rpm.cargo]
buildflags = ["--release"]

[package.metadata.rpm.files]
"../../doc/innernet.8.gz" = { path = "/usr/share/man/man8/innernet.8.gz" }
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" }
"../../doc/innernet.completions.bash" = { path = "/etc/bash_completion.d/innernet" }
"../../doc/innernet.completions.fish" = { path = "/usr/share/fish/vendor_completions.d/innernet.fish" }
"../../doc/innernet.completions.zsh" = { path = "/usr/share/zsh/site-functions/_innernet" }

[package.metadata.rpm.targets]
innernet = { path = "/usr/bin/innernet" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 4 additions & 62 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,67 +1,9 @@
[package]
authors = ["Jake McGinty <[email protected]>"]
description = "A client to manage innernet network interfaces."
edition = "2018"
homepage = "https://github.com/tonarino/innernet"
license = "MIT"
name = "client"
publish = false
repository = "https://github.com/tonarino/innernet"
version = "1.4.1"
version = "0.1.0"
authors = ["Bram Vandenbogaerde <contact@bramvdb.com>"]
edition = "2018"

[[bin]]
name = "innernet"
path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1"
colored = "2"
dialoguer = "0.8"
hostsfile = { path = "../hostsfile" }
indoc = "1"
ipnetwork = { git = "https://github.com/mcginty/ipnetwork" } # pending https://github.com/achanda/ipnetwork/pull/129
lazy_static = "1"
log = "0.4"
regex = { version = "1", default-features = false, features = ["std"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shared = { path = "../shared", default-features = false }
structopt = "0.3"
ureq = { version = "2", default-features = false, features = ["json"] }
wgctrl = { path = "../wgctrl-rs" }

[dev-dependencies]
tempfile = "3"

[package.metadata.deb]
assets = [
["target/release/innernet", "usr/bin/", "755"],
["target/release/innernet", "usr/bin/inn", "755"],
["[email protected]", "usr/lib/systemd/system/", "644"],
["../doc/innernet.8.gz", "usr/share/man/man8/", "644"],
["../doc/innernet.completions.bash", "etc/bash_completion.d/innernet", "644"],
["../doc/innernet.completions.fish", "usr/share/fish/vendor_completions.d/innernet.fish", "644"],
["../doc/innernet.completions.zsh", "usr/share/zsh/site-functions/_innernet", "644"],
]
depends = "libc6, libgcc1, systemd"
extended-description = "innernet client binary for fetching peer information and conducting admin tasks such as adding a new peer."
maintainer = "tonari <[email protected]>"
name = "innernet"
priority = "optional"
section = "net"

[package.metadata.rpm]
package = "innernet"

[package.metadata.rpm.cargo]
buildflags = ["--release"]

[package.metadata.rpm.files]
"../../doc/innernet.8.gz" = { path = "/usr/share/man/man8/innernet.8.gz" }
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" }
"../../doc/innernet.completions.bash" = { path = "/etc/bash_completion.d/innernet" }
"../../doc/innernet.completions.fish" = { path = "/usr/share/fish/vendor_completions.d/innernet.fish" }
"../../doc/innernet.completions.zsh" = { path = "/usr/share/zsh/site-functions/_innernet" }

[package.metadata.rpm.targets]
innernet = { path = "/usr/bin/innernet" }
7 changes: 7 additions & 0 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}