Skip to content

Introduce DatagramOptions - #12

Merged
altonen merged 5 commits into
eepnet:masterfrom
sjlgasnier:master
Jul 27, 2025
Merged

Introduce DatagramOptions#12
altonen merged 5 commits into
eepnet:masterfrom
sjlgasnier:master

Conversation

@sjlgasnier

@sjlgasnier sjlgasnier commented Jul 26, 2025

Copy link
Copy Markdown
Contributor

Aims at closing #9

I wrote 2 new doctests for the asynchronous module, but I had to set the root options.rs file to public in order to use DatagramOptions.
Is it an issue ?

Feel free to tear those doctests if so.

@altonen altonen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty! Left a few documentation nits.

You also need to re-export DatagramOptions in src/lib.rs, i.e., add DatagramOptions to pub use options::{...}

Comment thread src/options.rs
Comment on lines +402 to +423
#[derive(Default)]
pub struct DatagramOptions {
/// Overrides the source port
pub from_port: u16,

/// Overrides the destination port
pub to_port: u16,

/// Overrides the I2P protocol used
///
/// Only for RAW/Anonymous sessions
pub protocol: u8,

/// Overrides the crypto_tags_to_send I2CP option
pub send_tags: usize,

/// Overrides the crypto_low_tag_threshold I2CP option
pub tag_threshold: usize,

/// Overrides the should_bundle_reply_info I2CP option
pub send_leaseset: bool,
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[derive(Default)]
pub struct DatagramOptions {
/// Overrides the source port
pub from_port: u16,
/// Overrides the destination port
pub to_port: u16,
/// Overrides the I2P protocol used
///
/// Only for RAW/Anonymous sessions
pub protocol: u8,
/// Overrides the crypto_tags_to_send I2CP option
pub send_tags: usize,
/// Overrides the crypto_low_tag_threshold I2CP option
pub tag_threshold: usize,
/// Overrides the should_bundle_reply_info I2CP option
pub send_leaseset: bool,
}
/// Datagram options.
#[derive(Default)]
pub struct DatagramOptions {
/// Overrides the source port.
///
/// Defaults to `0`.
pub from_port: u16,
/// Overrides the destination port.
///
/// Defaults to `0`.
pub to_port: u16,
/// Overrides the I2P protocol used.
///
/// Only for RAW/Anonymous sessions.
///
/// Defaults to `18`.
pub protocol: u8,
/// Overrides the [`SessionOptions::crypto_tags_to_send`] I2CP option.
///
/// Defaults to `0`.
pub send_tags: usize,
/// Overrides the [`SessionOptions::crypto_low_tag_threshold`] I2CP option.
///
/// Defaults to `0`.
pub tag_threshold: usize,
/// Overrides the [`SessionOptions::should_bundle_reply_info`] I2CP option.
///
/// Defaults to `true`.
pub send_lease_set: bool,
}

options.to_port,
options.send_tags,
options.tag_threshold,
options.send_leaseset,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options.send_leaseset,
options.send_lease_set,

options.protocol,
options.send_tags,
options.tag_threshold,
options.send_leaseset,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options.send_leaseset,
options.send_lease_set,

options.protocol,
options.send_tags,
options.tag_threshold,
options.send_leaseset,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options.send_leaseset,
options.send_lease_set,

options.to_port,
options.send_tags,
options.tag_threshold,
options.send_leaseset,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options.send_leaseset,
options.send_lease_set,

@sjlgasnier
sjlgasnier requested a review from altonen July 27, 2025 10:48
Comment thread src/options.rs
@altonen
altonen merged commit 89def14 into eepnet:master Jul 27, 2025
1 check passed
@altonen altonen mentioned this pull request Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants