tor_guardmgr/bridge/config/
err.rs1use thiserror::Error;
7
8use tor_linkspec::ChannelMethod;
9
10#[derive(Error, Clone, Debug)]
12#[non_exhaustive]
13pub enum BridgeParseError {
14 #[cfg(feature = "bridge-client")]
16 #[error("Bridge line was empty")]
17 Empty,
18
19 #[cfg(feature = "bridge-client")]
21 #[error(
22 "Cannot parse {word:?} as PT name ({pt_error}), nor as direct bridge IpAddress:ORPort"
23 )]
24 InvalidPtOrAddr {
25 word: String,
27 pt_error: tor_linkspec::TransportIdError,
29 },
30
31 #[cfg(feature = "bridge-client")]
33 #[error(
34 "Cannot parse {word:?} as direct bridge IpAddress:ORPort ({addr_error}), nor as PT name"
35 )]
36 InvalidIpAddrOrPt {
37 word: String,
39 addr_error: std::net::AddrParseError,
41 },
42
43 #[cfg(feature = "pt-client")]
45 #[error("Cannot parse {word:?} as pluggable transport Host:ORPort")]
46 InvalidIPtHostAddr {
47 word: String,
49 #[source]
51 source: tor_linkspec::BridgeAddrError,
52 },
53
54 #[cfg(feature = "bridge-client")]
56 #[error("Cannot parse {word:?} as identity key ({id_error}), or PT key=value")]
57 InvalidIdentityOrParameter {
58 word: String,
60 id_error: tor_linkspec::RelayIdError,
62 },
63
64 #[cfg(feature = "pt-client")]
66 #[error("Expected PT key=value parameter, found {word:?} (which lacks an equals sign)")]
67 InvalidPtKeyValue {
68 word: String,
70 },
71
72 #[cfg(feature = "pt-client")]
74 #[error("Cannot parse {word:?} as a PT key=value parameter")]
75 InvalidPluggableTransportSetting {
76 word: String,
78 #[source]
80 source: tor_linkspec::PtTargetInvalidSetting,
81 },
82
83 #[cfg(feature = "bridge-client")]
85 #[error("More than one identity of the same type specified, at {word:?}")]
86 MultipleIdentitiesOfSameType {
87 word: String,
89 },
90
91 #[cfg(feature = "bridge-client")]
93 #[error("Identity specified but not of supported type, at {word:?}")]
94 UnsupportedIdentityType {
95 word: String,
97 },
98
99 #[error("Channel method specified but not of supported type ({method:?})")]
104 UnsupportedChannelMethod {
105 method: Box<ChannelMethod>,
107 },
108
109 #[cfg(feature = "bridge-client")]
111 #[error("Parameters supplied but not valid without a pluggable transport")]
112 DirectParametersNotAllowed,
113
114 #[cfg(feature = "bridge-client")]
116 #[error("Bridge line lacks specification of RSA identity key")]
117 NoRsaIdentity,
118
119 #[cfg(feature = "bridge-client")]
122 #[error("Pluggable transport requested ({word:?} is not an IpAddress:ORPort), but support disabled in cargo features")]
123 PluggableTransportsNotSupported {
124 word: String,
126 },
127
128 #[error("Bridge requested, but support disabled in cargo features")]
131 BridgesNotSupported,
132}