This commit is contained in:
Robin Appelman 2024-11-27 21:16:27 +01:00
commit ef8c3b961d
10 changed files with 146 additions and 38 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

17
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,17 @@
name: "CI"
on:
pull_request:
push:
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v26
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix flake check --keep-going

View file

@ -1,33 +0,0 @@
on: [push, pull_request]
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
test:
runs-on: ubuntu-latest
name: Tests
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: test

5
.gitignore vendored
View file

@ -1 +1,4 @@
/target .idea
target
result
.direnv

2
Cargo.lock generated
View file

@ -1,7 +1,5 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3
[[package]] [[package]]
name = "rfc7239" name = "rfc7239"
version = "0.1.1" version = "0.1.1"

View file

@ -7,6 +7,7 @@ description = "Parser for rfc7239 formatted Forwarded headers"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/icewind1991/rfc7239" repository = "https://github.com/icewind1991/rfc7239"
documentation = "https://docs.rs/rfc7239" documentation = "https://docs.rs/rfc7239"
rust-version = "1.56.1"
[dependencies] [dependencies]
uncased = "0.9.10" uncased = "0.9.10"

View file

@ -18,4 +18,4 @@ for node_result in parse(header_value) {
} }
``` ```
[rfc7239]: https://tools.ietf.org/html/rfc7239 [rfc7239]: https://tools.ietf.org/html/rfc7239

107
flake.lock generated Normal file
View file

@ -0,0 +1,107 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1730060262,
"narHash": "sha256-RMgSVkZ9H03sxC+Vh4jxtLTCzSjPq18UWpiM0gq6shQ=",
"owner": "ipetkov",
"repo": "crane",
"rev": "498d9f122c413ee1154e8131ace5a35a80d8fa76",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flakelight": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1732697024,
"narHash": "sha256-GcLauDQQI4xO4vy3e2QxPneR86FsJ1ubAbFDlTyEZ9s=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "1af817b5987e78b7a260dff6d62793716b98d794",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1732306573,
"narHash": "sha256-wE12kIIE0qb9V9y0JiVm5RsRrMNX+KeeMwkzwefdHhY=",
"owner": "icewind1991",
"repo": "mill-scale",
"rev": "8b4cbf174a9728d7e58bbfde5b5a6685dcbf1015",
"type": "github"
},
"original": {
"owner": "icewind1991",
"repo": "mill-scale",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1732632634,
"narHash": "sha256-+G7n/ZD635aN0sEXQLynU7pWMd3PKDM7yBIXvYmjABQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6f6076c37180ea3a916f84928cf3a714c5207a30",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-24.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"flakelight": "flakelight",
"mill-scale": "mill-scale",
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs"
]
},
"locked": {
"lastModified": 1731897198,
"narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "0be641045af6d8666c11c2c40e45ffc9667839b5",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

14
flake.nix Normal file
View file

@ -0,0 +1,14 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
};
mill-scale = {
url = "github:icewind1991/mill-scale";
inputs.flakelight.follows = "flakelight";
};
};
outputs = { mill-scale, ... }: mill-scale ./. { };
}

View file

@ -50,7 +50,7 @@ impl Display for RfcError {
impl Error for RfcError {} impl Error for RfcError {}
/// Parse an rfc7239 header value into a list of forwarded nodes /// Parse an rfc7239 header value into a list of forwarded nodes
pub fn parse(header_value: &str) -> impl Iterator<Item = Result<Forwarded, RfcError>> { pub fn parse(header_value: &str) -> impl DoubleEndedIterator<Item = Result<Forwarded, RfcError>> {
header_value.split(',').map(str::trim).map(Forwarded::parse) header_value.split(',').map(str::trim).map(Forwarded::parse)
} }