mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
udp load test: fix ipv6 issues, improve documentation
This commit is contained in:
parent
18635bf26c
commit
5a34bd4b81
2 changed files with 17 additions and 26 deletions
|
|
@ -17,12 +17,12 @@ pub struct ThreadId(pub u8);
|
|||
#[serde(default)]
|
||||
pub struct Config {
|
||||
/// Server address
|
||||
///
|
||||
/// If you want to send IPv4 requests to a IPv4+IPv6 tracker, put an IPv4
|
||||
/// address here.
|
||||
pub server_address: SocketAddr,
|
||||
pub log_level: LogLevel,
|
||||
/// Number of sockets and socket worker threads
|
||||
///
|
||||
/// Sockets will bind to one port each, and with
|
||||
/// multiple_client_ips = true, additionally to one IP each.
|
||||
pub num_socket_workers: u8,
|
||||
/// Number of workers generating requests from responses, as well as
|
||||
/// requests not connected to previous ones.
|
||||
|
|
@ -38,15 +38,14 @@ pub struct Config {
|
|||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct NetworkConfig {
|
||||
/// True means bind to one localhost IP per socket. On macOS, this by
|
||||
/// default causes all server responses to go to one socket worker.
|
||||
/// Default option ("true") can cause issues on macOS.
|
||||
/// True means bind to one localhost IP per socket.
|
||||
///
|
||||
/// The point of multiple IPs is to possibly cause a better distribution
|
||||
/// of requests to servers with SO_REUSEPORT option.
|
||||
pub multiple_client_ips: bool,
|
||||
/// Use Ipv6 only
|
||||
pub ipv6_client: bool,
|
||||
/// of requests to servers with SO_REUSEPORT option, but it doesn't
|
||||
/// necessarily help.
|
||||
///
|
||||
/// Setting this to true can cause issues on macOS.
|
||||
pub multiple_client_ipv4s: bool,
|
||||
/// Number of first client port
|
||||
pub first_port: u16,
|
||||
/// Socket worker poll timeout in microseconds
|
||||
|
|
@ -121,8 +120,7 @@ impl Default for Config {
|
|||
impl Default for NetworkConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
multiple_client_ips: true,
|
||||
ipv6_client: false,
|
||||
multiple_client_ipv4s: false,
|
||||
first_port: 45_000,
|
||||
poll_timeout: 276,
|
||||
poll_event_capacity: 2_877,
|
||||
|
|
|
|||
|
|
@ -72,25 +72,18 @@ fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
let (sender, receiver) = unbounded();
|
||||
let port = config.network.first_port + (i as u16);
|
||||
|
||||
let addr = if config.network.multiple_client_ips {
|
||||
let ip = if config.network.ipv6_client {
|
||||
// FIXME: test ipv6
|
||||
Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1 + i as u16).into()
|
||||
} else {
|
||||
Ipv4Addr::new(127, 0, 0, 1 + i).into()
|
||||
};
|
||||
|
||||
SocketAddr::new(ip, port)
|
||||
let ip = if config.server_address.is_ipv6() {
|
||||
Ipv6Addr::LOCALHOST.into()
|
||||
} else {
|
||||
let ip = if config.network.ipv6_client {
|
||||
Ipv6Addr::LOCALHOST.into()
|
||||
if config.network.multiple_client_ipv4s {
|
||||
Ipv4Addr::new(127, 0, 0, 1 + i).into()
|
||||
} else {
|
||||
Ipv4Addr::LOCALHOST.into()
|
||||
};
|
||||
|
||||
SocketAddr::new(ip, port)
|
||||
}
|
||||
};
|
||||
|
||||
let addr = SocketAddr::new(ip, port);
|
||||
|
||||
request_senders.push(sender);
|
||||
|
||||
let config = config.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue