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("Cannot parse {word:?} as PT name ({pt_error}), nor as direct bridge IpAddress:ORPort")]
22 InvalidPtOrAddr {
23 word: String,
25 pt_error: tor_linkspec::TransportIdError,
27 },
28
29 #[cfg(feature = "bridge-client")]
31 #[error(
32 "Cannot parse {word:?} as direct bridge IpAddress:ORPort ({addr_error}), nor as PT name"
33 )]
34 InvalidIpAddrOrPt {
35 word: String,
37 addr_error: std::net::AddrParseError,
39 },
40
41 #[cfg(feature = "pt-client")]
43 #[error("Cannot parse {word:?} as pluggable transport Host:ORPort")]
44 InvalidIPtHostAddr {
45 word: String,
47 #[source]
49 source: tor_linkspec::BridgeAddrError,
50 },
51
52 #[cfg(feature = "bridge-client")]
54 #[error("Cannot parse {word:?} as identity key ({id_error}), or PT key=value")]
55 InvalidIdentityOrParameter {
56 word: String,
58 id_error: tor_linkspec::RelayIdError,
60 },
61
62 #[cfg(feature = "pt-client")]
64 #[error("Expected PT key=value parameter, found {word:?} (which lacks an equals sign)")]
65 InvalidPtKeyValue {
66 word: String,
68 },
69
70 #[cfg(feature = "pt-client")]
72 #[error("Cannot parse {word:?} as a PT key=value parameter")]
73 InvalidPluggableTransportSetting {
74 word: String,
76 #[source]
78 source: tor_linkspec::PtTargetInvalidSetting,
79 },
80
81 #[cfg(feature = "bridge-client")]
83 #[error("More than one identity of the same type specified, at {word:?}")]
84 MultipleIdentitiesOfSameType {
85 word: String,
87 },
88
89 #[cfg(feature = "bridge-client")]
91 #[error("Identity specified but not of supported type, at {word:?}")]
92 UnsupportedIdentityType {
93 word: String,
95 },
96
97 #[error("Channel method specified but not of supported type ({method:?})")]
102 UnsupportedChannelMethod {
103 method: Box<ChannelMethod>,
105 },
106
107 #[cfg(feature = "bridge-client")]
109 #[error("Parameters supplied but not valid without a pluggable transport")]
110 DirectParametersNotAllowed,
111
112 #[cfg(feature = "bridge-client")]
114 #[error("Bridge line lacks specification of RSA identity key")]
115 NoRsaIdentity,
116
117 #[cfg(feature = "bridge-client")]
120 #[error(
121 "Pluggable transport requested ({word:?} is not an IpAddress:ORPort), but support disabled in cargo features"
122 )]
123 PluggableTransportsNotSupported {
124 word: String,
126 },
127
128 #[error("Bridge requested, but support disabled in cargo features")]
131 BridgesNotSupported,
132}