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

Add packet capture functionality and many more CLI improvements #182

Merged
merged 36 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3b1edd8
socket: Add method to get local address
Douile Nov 22, 2023
abbcae6
capture: Add packet capture infrastructure
Douile Nov 22, 2023
8d17ca4
cli: Add option to create a packet capture
Douile Nov 22, 2023
49096e4
merge: Douile fork + local (broken af)
cainthebest Jan 12, 2024
3d47180
refactor: backport pcap impl
cainthebest Jan 13, 2024
0543cab
refactor: clean up
cainthebest Jan 13, 2024
6aee5eb
chore: format
cainthebest Jan 13, 2024
6cf6800
chore: add source link
cainthebest Jan 13, 2024
61ecbab
refactor: clean up and add more features
cainthebest Jan 15, 2024
c30f287
impl: tcp fin
cainthebest Jan 15, 2024
89d4dde
fix: bson output
cainthebest Jan 16, 2024
15004f3
chore: optimize further
cainthebest Jan 16, 2024
36d957c
Merge branch 'main' into feat/rootless-capture
cainthebest Jan 18, 2024
1991c9f
chore: add missing cli fn docs
cainthebest Jan 18, 2024
b495255
chore: format
cainthebest Jan 18, 2024
962c856
fix: packet support for msrv
cainthebest Jan 18, 2024
3eb20b9
fix: mindustry leak crate-private type
cainthebest Jan 18, 2024
e615c63
fix: cli unused import + undeclared crate
cainthebest Jan 18, 2024
bedd277
fix: variant `Action::Query` does not have this field
cainthebest Jan 18, 2024
b1e42f9
refactor: clippy fixs
cainthebest Jan 18, 2024
5dff511
refactor: clippy fix + docs
cainthebest Jan 18, 2024
2deb1df
impl: cli release workflow (x86_64, win, dar, linux, wasm32-wasi)
cainthebest Jan 19, 2024
bba9f5f
cli: Improve capture help string
Douile Jan 22, 2024
8f381f7
chore: change cli header year
cainthebest Feb 2, 2024
5365845
fix: cli xml `LastElementNameNotAvailable` error case
cainthebest Feb 2, 2024
df51521
fix: remove bug panic due to xml protocol format now being supported
cainthebest Feb 2, 2024
422cb57
chore: update cli default features
cainthebest Feb 2, 2024
5310200
fix: cli xml feat not having json dep
cainthebest Feb 2, 2024
7442304
revert: lib default feat to exclude packet capture
cainthebest Feb 2, 2024
4675b24
refactor: better xml support and error prop
cainthebest Feb 2, 2024
48aa511
fix: add xml utf8 and semver declaration
cainthebest Feb 2, 2024
c34392a
refactor: pcap packet buffer size
cainthebest Feb 7, 2024
9a2b953
refactor: capture socket and move to capture dir
cainthebest Feb 7, 2024
7b37e71
chore: remove unused else
cainthebest Feb 7, 2024
730c938
chore: format
cainthebest Feb 7, 2024
7369dba
refactor: use slices where possable in pcap
cainthebest Feb 7, 2024
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
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
release:
types: [created]

jobs:
release:
name: Release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz tar.zst
- target: x86_64-apple-darwin
archive: zip
- target: wasm32-wasi
archive: zip tar.gz
steps:
- uses: actions/checkout@v4
- name: Compile and release
uses: rust-build/rust-build.action@v1.4.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ resolver = "2"
opt-level = 3
debug = false
rpath = true
lto = true
lto = 'fat'
codegen-units = 1

[profile.release.package."*"]
opt-level = 3
42 changes: 36 additions & 6 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,44 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["json"]
default = ["json", "bson", "xml", "browser"]

# Tools
packet_capture = ["gamedig/packet_capture"]

# Output formats
bson = ["dep:serde", "dep:bson", "dep:hex", "dep:base64", "gamedig/serde"]
json = ["dep:serde", "dep:serde_json", "gamedig/serde"]
xml = ["dep:serde", "dep:serde_json", "dep:quick-xml", "gamedig/serde"]

# Misc
browser = ["dep:webbrowser"]

[dependencies]
clap = { version = "4.1.11", features = ["derive"] }
gamedig = { version = "*", path = "../lib", features = ["clap"] }
# Core Dependencies
thiserror = "1.0.43"
clap = { version = "4.1.11", default-features = false, features = ["derive"] }
gamedig = { version = "*", path = "../lib", default-features = false, features = [
"clap",
"games",
"game_defs",
] }

# Feature Dependencies
# Serialization / Deserialization
serde = { version = "1", optional = true, default-features = false }

# BSON
bson = { version = "2.8.1", optional = true, default-features = false }
base64 = { version = "0.21.7", optional = true, default-features = false, features = ["std"]}
hex = { version = "0.4.3", optional = true, default-features = false }

# JSON
serde_json = { version = "1", optional = true, default-features = false }

# XML
quick-xml = { version = "0.31.0", optional = true, default-features = false }

# Browser
webbrowser = { version = "0.8.12", optional = true, default-features = false }

# JSON dependencies
serde = { version = "1", optional = true }
serde_json = { version = "1", optional = true }
12 changes: 12 additions & 0 deletions crates/cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ pub enum Error {
#[error("Gamedig Error: {0}")]
Gamedig(#[from] gamedig::errors::GDError),

#[cfg(any(feature = "json", feature = "xml"))]
#[error("Serde Error: {0}")]
Serde(#[from] serde_json::Error),

#[cfg(feature = "bson")]
#[error("Bson Error: {0}")]
Bson(#[from] bson::ser::Error),

#[cfg(feature = "xml")]
#[error("Xml Error: {0}")]
Xml(#[from] quick_xml::Error),

#[error("Unknown Game: {0}")]
UnknownGame(String),

Expand Down
Loading
Loading