Skip to content

Commit f3708b0

Browse files
committed
Merge branch 'use-split_at_checked'
2 parents a3b1bf9 + f9cc1b4 commit f3708b0

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- os: ubuntu-latest
6868
# MSRV. Not considered breaking when this has to be bumped.
6969
# But update `rust-version` in `Cargo.toml`
70-
rust: 1.77.0
70+
rust: 1.80.0
7171
runs-on: ${{ matrix.os }}
7272
steps:
7373
- uses: actions/checkout@v4

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
66
description = "Tunnel UDP traffic inside a TCP stream. Each datagram is prefixed with a 16 bit unsigned integer containing the length"
77
repository = "https://github.com/mullvad/udp-over-tcp"
88
edition = "2021"
9-
rust-version = "1.77.0"
9+
rust-version = "1.80.0"
1010
publish = false
1111

1212
[[bin]]

src/forward_traffic.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,7 @@ fn split_first_datagram(buffer: &[u8]) -> Option<(&[u8], &[u8])> {
127127
let (header, tail) = buffer.split_first_chunk::<HEADER_LEN>()?;
128128
let datagram_len = usize::from(u16::from_be_bytes(*header));
129129

130-
// TODO: These two get calls (and thus double bounds check) can be replaced with
131-
// `split_at_checked` when stabilized: https://github.com/rust-lang/rust/issues/119128
132-
let datagram_data = tail.get(..datagram_len)?;
133-
let tail = tail.get(datagram_len..)?;
134-
135-
Some((datagram_data, tail))
130+
tail.split_at_checked(datagram_len)
136131
}
137132

138133
/// Reads datagrams from `udp_in` and writes them (with the 16 bit header containing the length)

0 commit comments

Comments
 (0)