mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
udp: add network.only_ipv6 config flag
This commit is contained in:
parent
4641dd29f2
commit
4b07e007f3
3 changed files with 6 additions and 2 deletions
2
TODO.md
2
TODO.md
|
|
@ -20,12 +20,10 @@
|
||||||
* uring
|
* uring
|
||||||
* ValidUntil periodic update
|
* ValidUntil periodic update
|
||||||
* statistics
|
* statistics
|
||||||
* ipv6_only
|
|
||||||
* shared config keys such as poll interval
|
* shared config keys such as poll interval
|
||||||
* mio
|
* mio
|
||||||
* stagger connection cleaning intervals?
|
* stagger connection cleaning intervals?
|
||||||
* ipv4-mapped addresses
|
* ipv4-mapped addresses
|
||||||
* ipv6_only
|
|
||||||
* glommio
|
* glommio
|
||||||
* consider sending local responses immediately
|
* consider sending local responses immediately
|
||||||
* consider adding ConnectedScrapeRequest::Scrape(PendingScrapeRequest)
|
* consider adding ConnectedScrapeRequest::Scrape(PendingScrapeRequest)
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,10 @@ pub fn create_socket(config: &Config) -> ::std::net::UdpSocket {
|
||||||
}
|
}
|
||||||
.expect("create socket");
|
.expect("create socket");
|
||||||
|
|
||||||
|
if config.network.only_ipv6 {
|
||||||
|
socket.set_only_v6(true).expect("socket: set only ipv6");
|
||||||
|
}
|
||||||
|
|
||||||
socket.set_reuse_port(true).expect("socket: set reuse port");
|
socket.set_reuse_port(true).expect("socket: set reuse port");
|
||||||
|
|
||||||
socket
|
socket
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ impl aquatic_cli_helpers::Config for Config {
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
/// Bind to this address
|
/// Bind to this address
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
pub only_ipv6: bool,
|
||||||
/// Size of socket recv buffer. Use 0 for OS default.
|
/// Size of socket recv buffer. Use 0 for OS default.
|
||||||
///
|
///
|
||||||
/// This setting can have a big impact on dropped packages. It might
|
/// This setting can have a big impact on dropped packages. It might
|
||||||
|
|
@ -120,6 +121,7 @@ impl Default for NetworkConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
address: SocketAddr::from(([0, 0, 0, 0], 3000)),
|
address: SocketAddr::from(([0, 0, 0, 0], 3000)),
|
||||||
|
only_ipv6: false,
|
||||||
socket_recv_buffer_size: 4096 * 128,
|
socket_recv_buffer_size: 4096 * 128,
|
||||||
#[cfg(feature = "with-mio")]
|
#[cfg(feature = "with-mio")]
|
||||||
poll_event_capacity: 4096,
|
poll_event_capacity: 4096,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue