Skip to content

Commit

Permalink
Removal of client->connection_id (#114)
Browse files Browse the repository at this point in the history
Since the inclusion of the connection id token is being processed as a
filter, we no longer have a need for connection_id in the client
configuration.

Work on #8
  • Loading branch information
markmandel authored Oct 23, 2020
1 parent f6abd60 commit 95cfb9d
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 31 deletions.
1 change: 0 additions & 1 deletion docs/extensions/filters/concatenate_bytes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ filters:
client:
addresses:
- 127.0.0.1:7001
connection_id: MXg3aWp5Ng==
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.len(), 1);
Expand Down
1 change: 0 additions & 1 deletion docs/extensions/filters/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ filters:
client:
addresses:
- 127.0.0.1:7001
connection_id: MXg3aWp5Ng==
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.len(), 1);
Expand Down
1 change: 0 additions & 1 deletion docs/extensions/filters/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ filters:
client:
addresses:
- 127.0.0.1:7001
connection_id: MXg3aWp5Ng==
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.validate().unwrap(), ());
Expand Down
1 change: 0 additions & 1 deletion docs/extensions/filters/local_rate_limit.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ filters:
client:
addresses:
- 127.0.0.1:7001
connection_id: MXg3aWp5Ng==
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.len(), 1);
Expand Down
1 change: 0 additions & 1 deletion examples/client-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ client:
addresses: # array of potential endpoints to send traffic to
- 127.0.0.1:7000
- 127.0.0.1:7001
connection_id: MXg3aWp5Ng== # the connection byte array to attach to the traffic, encoded as base64 (string value: 1x7ijy6)
lb_policy: ROUND_ROBIN # (Optional) load balancing policy for selecting endpoints.
# Possible values are: `ROUND_ROBIN` `RANDOM` `BROADCAST`
# Defaults to `BROADCAST` if not set.
12 changes: 1 addition & 11 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ pub enum ConnectionConfig {
#[serde(rename = "client")]
Client {
addresses: Vec<SocketAddr>,
connection_id: ConnectionId,
lb_policy: Option<LoadBalancerPolicy>,
},

Expand Down Expand Up @@ -148,7 +147,6 @@ impl Config {
}
ConnectionConfig::Client {
addresses,
connection_id: _,
lb_policy: _,
} => {
if addresses.iter().collect::<HashSet<_>>().len() != addresses.len() {
Expand All @@ -170,8 +168,7 @@ mod tests {
use serde_yaml::Value;

use crate::config::{
Builder, Config, ConnectionConfig, ConnectionId, EndPoint, LoadBalancerPolicy, Local,
ValidationError,
Builder, Config, ConnectionConfig, EndPoint, LoadBalancerPolicy, Local, ValidationError,
};

#[test]
Expand All @@ -180,7 +177,6 @@ mod tests {
.with_local(Local { port: 7000 })
.with_connections(ConnectionConfig::Client {
addresses: vec!["127.0.0.1:25999".parse().unwrap()],
connection_id: "1234".into(),
lb_policy: Some(LoadBalancerPolicy::RoundRobin),
})
.build();
Expand Down Expand Up @@ -228,7 +224,6 @@ filters: # new filters section
client:
addresses:
- 127.0.0.1:7001
connection_id: MXg3aWp5Ng== # 1x7ijy6
";
let config = Config::from_reader(yaml.as_bytes()).unwrap();

Expand Down Expand Up @@ -259,18 +254,15 @@ local:
client:
addresses:
- 127.0.0.1:25999
connection_id: MXg3aWp5Ng== # 1x7ijy6
lb_policy: ROUND_ROBIN
";
let config = Config::from_reader(yaml.as_bytes()).unwrap();
assert_eq!(7000, config.local.port);
match config.connections {
ConnectionConfig::Client {
addresses,
connection_id,
lb_policy,
} => {
assert_eq!(ConnectionId::from("1x7ijy6"), connection_id);
assert_eq!(
vec!["127.0.0.1:25999".parse::<SocketAddr>().unwrap()],
addresses
Expand Down Expand Up @@ -331,7 +323,6 @@ server:
"127.0.0.1:25999".parse().unwrap(),
"127.0.0.1:25998".parse().unwrap(),
],
connection_id: "1234".into(),
lb_policy: Some(LoadBalancerPolicy::RoundRobin),
})
.build();
Expand All @@ -346,7 +337,6 @@ server:
"127.0.0.1:25999".parse().unwrap(),
"127.0.0.1:25999".parse().unwrap(),
],
connection_id: "1234".into(),
lb_policy: Some(LoadBalancerPolicy::RoundRobin),
})
.build();
Expand Down
2 changes: 0 additions & 2 deletions src/extensions/filter_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ mod tests {
}])
.with_connections(ConnectionConfig::Client {
addresses: vec!["127.0.0.1:2456".parse().unwrap()],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand All @@ -156,7 +155,6 @@ mod tests {
}])
.with_connections(ConnectionConfig::Client {
addresses: vec!["127.0.0.1:2456".parse().unwrap()],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand Down
1 change: 0 additions & 1 deletion src/extensions/filters/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use crate::extensions::Filter;
/// client:
/// addresses:
/// - 127.0.0.1:7001
/// connection_id: 1x7ijy6
/// ```
/// `config.id` (optional) adds a "id" field with a given value to each log line.
/// This can be useful to identify debug log positioning within a filter config if you have
Expand Down
1 change: 0 additions & 1 deletion src/extensions/filters/local_rate_limit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ mod metrics;
/// client:
/// addresses:
/// - 127.0.0.1:7001
/// connection_id: 1x7ijy6
/// ```
/// `config.max_packets` is the maximum number of packets allowed
/// to be forwarded by the rate limiter in a given duration.
Expand Down
3 changes: 0 additions & 3 deletions src/load_balancer_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ mod tests {

let lb = LoadBalancerPolicy::new(&ConnectionConfig::Client {
addresses: addresses.clone(),
connection_id: "".into(),
lb_policy: Some(RoundRobin),
});

Expand Down Expand Up @@ -172,7 +171,6 @@ mod tests {

let lb = LoadBalancerPolicy::new(&ConnectionConfig::Client {
addresses: addresses.clone(),
connection_id: "".into(),
lb_policy: Some(Random),
});

Expand Down Expand Up @@ -222,7 +220,6 @@ mod tests {

let lb = LoadBalancerPolicy::new(&ConnectionConfig::Client {
addresses: addresses.clone(),
connection_id: "".into(),
lb_policy,
});

Expand Down
4 changes: 0 additions & 4 deletions src/proxy/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ mod tests {
})
.with_connections(ConnectionConfig::Client {
addresses: vec![endpoint.addr],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand Down Expand Up @@ -428,7 +427,6 @@ mod tests {
}])
.with_connections(ConnectionConfig::Client {
addresses: vec![endpoint.addr],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand Down Expand Up @@ -490,7 +488,6 @@ mod tests {

let lb_policy = Arc::new(LoadBalancerPolicy::new(&ConnectionConfig::Client {
addresses: vec![endpoint.addr],
connection_id: "".into(),
lb_policy: None,
}));

Expand Down Expand Up @@ -578,7 +575,6 @@ mod tests {
let endpoint = t.open_socket_and_recv_single_packet().await;
let lb_policy = Arc::new(LoadBalancerPolicy::new(&ConnectionConfig::Client {
addresses: vec![endpoint.addr],
connection_id: "".into(),
lb_policy: None,
}));
let SplitSocket {
Expand Down
2 changes: 0 additions & 2 deletions tests/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ mod tests {
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),
server_port,
)],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand Down Expand Up @@ -154,7 +153,6 @@ mod tests {
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),
server_port,
)],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand Down
1 change: 0 additions & 1 deletion tests/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ mod tests {
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),
server_port,
)],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand Down
1 change: 0 additions & 1 deletion tests/no_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ mod tests {
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),
server_port,
)],
connection_id: "".into(),
lb_policy: None,
})
.build();
Expand Down

0 comments on commit 95cfb9d

Please sign in to comment.