Skip to content

Commit 32a8d34

Browse files
committed
init: proxy-protocol-codec
0 parents  commit 32a8d34

File tree

18 files changed

+3595
-0
lines changed

18 files changed

+3595
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Compatability
2+
3+
on:
4+
push:
5+
paths: [ "src/**", "Cargo.toml"]
6+
workflow_dispatch: {}
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build:
13+
name: Validate Compatibility
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
toolchain: [stable, beta, nightly]
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
features: ["--features default", "--no-default-features", "--all-features"]
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: actions-rs/toolchain@v1
23+
with:
24+
toolchain: ${{ matrix.toolchain }}
25+
override: true
26+
- name: Cache Cargo
27+
uses: Swatinem/rust-cache@v1.3.0
28+
- name: Build
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: build
32+
args: --verbose --release ${{ matrix.features }}
33+
- name: Test
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: test
37+
args: --verbose --release ${{ matrix.features }}
38+
env:
39+
RUST_BACKTRACE: 1

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test
2+
3+
on: [ push, workflow_dispatch ]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
test:
10+
name: Build & Test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
toolchain: stable
17+
override: true
18+
- name: Cache Cargo
19+
uses: Swatinem/rust-cache@v1.3.0
20+
- name: Build
21+
uses: actions-rs/cargo@v1
22+
with:
23+
command: build
24+
args: --verbose --all-features
25+
- name: Test
26+
uses: actions-rs/cargo@v1
27+
with:
28+
command: test
29+
args: --verbose --all-features
30+
env:
31+
RUST_BACKTRACE: 1

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
/target/
4+
5+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
6+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
7+
Cargo.lock
8+
9+
# These are backup files generated by rustfmt
10+
**/*.rs.bk
11+
12+
13+
#Added by cargo
14+
#
15+
#already existing elements are commented out
16+
17+
/target
18+
#**/*.rs.bk
19+
#Cargo.lock
20+
21+
.idea/

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rust-analyzer.cargo.features": [
3+
"feat-nightly"
4+
]
5+
}

Cargo.toml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
[package]
2+
name = "proxy-protocol-codec"
3+
version = "0.1.0"
4+
edition = "2021"
5+
rust-version = "1.77.0"
6+
7+
# === Publication info ===
8+
authors = ["Hantong Chen <cxwdyx620@gmail.com>", "Miguel D. Salcedo <miguel@salcedo.cc>"]
9+
categories = ["network-programming"]
10+
description = "PROXY Protocol codec implementation in Rust. See HAProxy for the protocol specification."
11+
keywords = ["proxy", "protocol", "haproxy", "codec", "decode", "encode"]
12+
license = "Apache-2.0"
13+
readme = "README.md"
14+
repository = "https://github.com/hanyu-dev/proxy-protocol-codec"
15+
16+
[dependencies]
17+
crc32c = { version = "0.6", default-features = false, optional = true }
18+
slicur = { version = "0.2", optional = true }
19+
thiserror = { version = "2.0", optional = true }
20+
uni-addr = { version = "0.2", default-features = false, optional = true }
21+
wrapper-lite = { version = "0.1", default-features = false }
22+
23+
[dev-dependencies]
24+
criterion = { version = "0.7.0", features = ["html_reports"] }
25+
ppp = "=2.3.0"
26+
27+
# [target.'cfg(unix)'.dev-dependencies]
28+
# pprof = { version = "0.15.0", features = ["criterion", "flamegraph", "protobuf-codec"] }
29+
30+
[features]
31+
default = [
32+
"feat-std",
33+
"feat-codec-encode",
34+
"feat-codec-decode",
35+
"feat-codec-v1",
36+
"feat-codec-v2",
37+
"feat-codec-v2-crc32c",
38+
"feat-codec-v2-uni-addr",
39+
]
40+
41+
# Enable std support.
42+
feat-std = []
43+
44+
# Enable nightly features.
45+
feat-nightly = []
46+
47+
# Enable encoding support.
48+
feat-codec-encode = ["dep:thiserror"]
49+
50+
# Enable decoding support.
51+
feat-codec-decode = ["dep:thiserror", "dep:slicur"]
52+
53+
# Enable the v1 codec support.
54+
feat-codec-v1 = []
55+
56+
# Enable the v2 codec support.
57+
feat-codec-v2 = []
58+
59+
# Enable the v2 codec CRC32c support.
60+
feat-codec-v2-crc32c = ["feat-std", "dep:crc32c"]
61+
62+
# Enable uni-addr support.
63+
feat-codec-v2-uni-addr = ["feat-std", "dep:uni-addr"]
64+
65+
[lints]
66+
clippy.allow_attributes_without_reason = "warn"
67+
clippy.assertions_on_result_states = "warn"
68+
clippy.assigning_clones = "warn"
69+
clippy.bool_to_int_with_if = "warn"
70+
clippy.cognitive_complexity = "warn"
71+
clippy.create_dir = "warn"
72+
clippy.dbg_macro = "warn"
73+
clippy.debug_assert_with_mut_call = "warn"
74+
clippy.default_trait_access = "warn"
75+
clippy.disallowed_script_idents = "deny"
76+
clippy.doc_link_with_quotes = "warn"
77+
clippy.doc_markdown = "warn"
78+
clippy.else_if_without_else = "deny"
79+
clippy.enum_glob_use = "warn"
80+
clippy.filetype_is_file = "warn"
81+
clippy.inefficient_to_string = "warn"
82+
clippy.mem_forget = "warn"
83+
clippy.missing_panics_doc = "warn"
84+
clippy.mod_module_files = "deny"
85+
clippy.multiple_inherent_impl = "warn"
86+
clippy.mutex_atomic = "warn"
87+
clippy.mutex_integer = "warn"
88+
clippy.needless_continue = "warn"
89+
clippy.panic = "warn"
90+
clippy.significant_drop_in_scrutinee = "warn"
91+
clippy.todo = "warn"
92+
clippy.unimplemented = "warn"
93+
clippy.unreachable = "warn"
94+
clippy.wildcard_dependencies = "deny"
95+
clippy.wildcard_imports = "warn"
96+
rust.unsafe_code = "warn"
97+
rust.missing_docs = "warn"
98+
rust.missing_debug_implementations = "warn"
99+
rust.unreachable_pub = "warn"
100+
101+
[[bench]]
102+
name = "comparison"
103+
harness = false

0 commit comments

Comments
 (0)