Skip to content

Commit

Permalink
bad codecov
Browse files Browse the repository at this point in the history
Signed-off-by: iGxnon <igxnon@gmail.com>
  • Loading branch information
iGxnon committed May 30, 2024
1 parent acc75bf commit ba38227
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 33 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ Yet another project rewritten in Rust.
## Features

- `Stream`/`Sink`/`Future` based async API.
- Support `Unreliable`, `Reliable` and `ReliableOrdered` packets.
- Support multiple order channels.
- Support `ACK`/`NACK` mechanism.
- Low level API but easy to use.
- Low level API but easy to use.
- RakNet features:
- Support `Unreliable`, `Reliable` and `ReliableOrdered` packets.
- Support multiple order channels.
- Support `ACK`/`NACK` mechanism.
- Full tracing powered by [minitrace-rust](https://github.com/tikv/minitrace-rust).
- You can track a packet's span during deduplication, fragmentation, ... layers.

## Roadmap

> Ordered by priority
- Add sliding window congestion control
- Documentation
- More fuzz testing
- Bulk benchmark

## Getting Started

See [examples](examples/) for usage.
See [examples](examples/) for basic usage.

### Server

Expand Down
4 changes: 2 additions & 2 deletions ci/scripts/upload-codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ fi
set -euo pipefail
curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov

max_retry=${MAX_RETRY-20}
max_retry=${MAX_RETRY-100}
file=${1-"lcov.info"}
retry_delay=${RETRY_DELAY-30}
retry_delay=${RETRY_DELAY-5}

counter=0

Expand Down
16 changes: 16 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# codecov config
# Reference: https://docs.codecov.com/docs/codecovyml-reference
# Tips. You may run following command to validate before committing any changes
# curl --data-binary @codecov.yml https://codecov.io/validate
coverage:
status:
patch: off # disable patch status
project:
default: false # disable the default status that measures entire project
rust:
paths:
- "src/"
target: auto # compared with the coverage from the base commit
threshold: 0.1% # allow the coverage to drop by 0.1% and posting a success status
codecov:
allow_coverage_offsets: true
9 changes: 3 additions & 6 deletions src/client/conn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@ pub struct Config {
protocol_version: u8,

/// Limit the max size of a parted frames set, 0 means no limit
/// It will abort the split frame if the parted_size reaches limit.
/// Enable it to avoid DoS attack.
/// The maximum number of inflight parted frames is max_parted_size * max_parted_count
/// It will abort the split frame if the `parted_size` reaches limit.
/// The maximum number of inflight parted frames is `max_parted_size` * `max_parted_count`
#[builder(default = "256")]
max_parted_size: u32,
/// Limit the max count of **all** parted frames sets from an address.
/// It might cause client resending frames if the limit is reached.
/// Enable it to avoid DoS attack.
/// The maximum number of inflight parted frames is max_parted_size * max_parted_count
/// The maximum number of inflight parted frames is `max_parted_size` * `max_parted_count`
#[builder(default = "256")]
max_parted_count: usize,
/// Maximum ordered channel, the value should be less than 256
#[builder(default = "1")]
max_channels: usize,
// Limit the maximum deduplication gap for a connection, 0 means no limit.
// Enable it to avoid D-DoS attack based on deduplication.
#[builder(default = "1024")]
max_dedup_gap: usize,
}
Expand Down
10 changes: 5 additions & 5 deletions src/codec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ use crate::Message;
#[derive(Clone, Copy, Debug, Builder)]
pub(crate) struct Config {
/// Limit the max size of a parted frames set, 0 means no limit
/// It will abort the split frame if the parted_size reaches limit.
/// Enable it to avoid DoS attack.
/// The maximum number of inflight parted frames is max_parted_size * max_parted_count
/// It will abort the split frame if the `parted_size` reaches limit.
/// Enable it to avoid `DoS` attack.
/// The maximum number of inflight parted frames is `max_parted_size` * `max_parted_count`nt
max_parted_size: u32,
/// Limit the max count of **all** parted frames sets from an address.
/// It might cause client resending frames if the limit is reached.
/// Enable it to avoid DoS attack.
/// The maximum number of inflight parted frames is max_parted_size * max_parted_count
/// Enable it to avoid `DoS` attack.
/// The maximum number of inflight parted frames is `max_parted_size` * `max_parted_count`nt
max_parted_count: usize,
/// Maximum ordered channel, the value should be less than 256
max_channels: usize,
Expand Down
4 changes: 1 addition & 3 deletions src/packet/connected/ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ impl AckOrNack {
// pack_type(1) + length(2) + single record(4) = 7
debug_assert!(mtu >= 7, "7 is the least size of mtu");

let Some(mut first) = sorted_seq_nums.next() else {
return None;
};
let mut first = sorted_seq_nums.next()?;

let mut records = vec![];
let mut last = first;
Expand Down
14 changes: 7 additions & 7 deletions src/packet/connected/frame_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ impl Hash for Flags {
#[derive(Debug, Clone, Eq, PartialEq, Copy)]
#[repr(u8)]
pub enum Reliability {
/// Same as regular UDP, except that it will also discard duplicate datagrams. RakNet adds (6
/// to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6 to 17
/// of which is used for message length.
/// Same as regular UDP, except that it will also discard duplicate datagrams. `RakNet` adds
/// (6 to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6
/// to 17 of which is used for message length.
Unreliable = 0b000,

/// Regular UDP with a sequence counter. Out of order messages will be discarded.
Expand All @@ -211,12 +211,12 @@ pub enum Reliability {
Reliable = 0b010,

/// This message is reliable and will arrive in the order you sent it. Messages will be
/// delayed while waiting for out of order messages. Same overhead as UnreliableSequenced.
/// delayed while waiting for out of order messages. Same overhead as `UnreliableSequenced`.
/// Sequenced and ordered messages sent on the same channel will arrive in the order sent.
ReliableOrdered = 0b011,

/// This message is reliable and will arrive in the sequence you sent it. Out of order
/// messages will be dropped. Same overhead as UnreliableSequenced. Sequenced and ordered
/// messages will be dropped. Same overhead as `UnreliableSequenced`. Sequenced and ordered
/// messages sent on the same channel will arrive in the order sent.
ReliableSequenced = 0b100,

Expand All @@ -228,7 +228,7 @@ pub enum Reliability {
/// NACK based on the result of sending this message when calling.
ReliableWithAckReceipt = 0b110,

/// Same as ReliableOrdered, however the peer will get either ACK or
/// Same as `ReliableOrdered`, however the peer will get either ACK or
/// NACK based on the result of sending this message when calling.
ReliableOrderedWithAckReceipt = 0b111,
}
Expand Down Expand Up @@ -330,7 +330,7 @@ impl Flags {
// It is checked before transmute
Self {
raw,
reliability: unsafe { std::mem::transmute(r) },
reliability: unsafe { std::mem::transmute::<u8, Reliability>(r) },
parted: raw & PARTED_FLAG != 0,
needs_bas: raw & NEEDS_B_AND_AS_FLAG != 0,
}
Expand Down
10 changes: 5 additions & 5 deletions src/server/incoming/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ pub struct Config {
max_pending: usize,

/// Limit the max size of a parted frames set, 0 means no limit
/// It will abort the split frame if the parted_size reaches limit.
/// Enable it to avoid DoS attack.
/// The maximum number of inflight parted frames is max_parted_size * max_parted_count
/// It will abort the split frame if the `parted_size` reaches limit.
/// Enable it to avoid `DoS` attack.
/// The maximum number of inflight parted frames is `max_parted_size`*`max_parted_count`nt
#[builder(default = "256")]
max_parted_size: u32,
/// Limit the max count of **all** parted frames sets from an address.
/// It might cause client resending frames if the limit is reached.
/// Enable it to avoid DoS attack.
/// The maximum number of inflight parted frames is max_parted_size * max_parted_count
/// Enable it to avoid `DoS` attack.
/// The maximum number of inflight parted frames is `max_parted_size`*`max_parted_count`nt
#[builder(default = "256")]
max_parted_count: usize,
/// Maximum ordered channel, the value should be less than 256
Expand Down

0 comments on commit ba38227

Please sign in to comment.