impl Hash for BridgeConfig and various PT information

The bridge descriptor manager wants to index data structures by the
BridgeConfig.
This commit is contained in:
Ian Jackson 2022-10-24 18:38:47 +01:00
parent a89daba1c8
commit a56efbfdf0
2 changed files with 4 additions and 4 deletions

View File

@ -50,7 +50,7 @@ use tor_linkspec::{PtAddrError, PtTarget, PtTargetAddr, PtTargetInvalidSetting};
/// * When a pluggable transport is in use,
/// zero or more `key=value` parameters to pass to the transport
/// (smuggled in the SOCKS handshake, as described in the Tor PT specification).
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
// TODO pt-client: Derive builder and associated config types. See ticket #604.
pub struct BridgeConfig {
// TODO pt-client: I am not sold on this exact representation for Bridge; it

View File

@ -250,7 +250,7 @@ impl Display for PtTargetAddr {
///
/// This type is _not_ for settings that apply to _all_ of the connections over
/// a transport.
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, Eq, PartialEq, Hash, Serialize, Deserialize)]
// TODO pt-client: I am not sure we will want to keep this type, rather than
// just inlining it. I am leaving it as a separate type for now, though, for a
// few reasons:
@ -269,7 +269,7 @@ pub struct PtTargetSettings {
/// The set of information passed to the pluggable transport subsystem in order
/// to establish a connection to a bridge relay.
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct PtTarget {
/// The transport to be used.
transport: PtTransportName,
@ -374,7 +374,7 @@ impl PtTarget {
/// For direct connections, this is simply an address. For connections via a
/// pluggable transport, this includes information about the transport, and any
/// address and settings information that transport requires.
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[allow(clippy::exhaustive_enums)]
// TODO pt-client: I am not in love with this enum name --nm.
// TODO pt-client: Maybe "ContactMethod" would be better?