pub struct GateTarget { /* private fields */ }Expand description
Where a tenant command sends its requests: the canonical origin it signs for, and the local plain-HTTP address it connects to.
The client has no TLS transport in Step 2. It opens plain HTTP to the
connect address, sends Host: <canonical authority> and signs
<canonical origin><path>, so the gate sees exactly the request it
would see behind the public origin. The connect address must be a
loopback literal (an address in 127.0.0.0/8, [::1], or localhost,
which is dialled as 127.0.0.1 without a name lookup), because a signed
request sent in clear text off the machine could be captured and spent.
§Examples
use stratum_node_cli::GateTarget;
let target = GateTarget::new(
"https://stratum.visionclaw.pro".parse()?,
Some("127.0.0.1:7461".parse()?),
)?;
assert_eq!(target.connect().authority(), "127.0.0.1:7461");
// The remote transport arrives with the public origin.
assert!(GateTarget::new("https://stratum.visionclaw.pro".parse()?, None).is_err());
// A local http:// origin is reached at its own address.
let local = GateTarget::new("http://127.0.0.1:7461".parse()?, None)?;
assert_eq!(local.connect().authority(), "127.0.0.1:7461");Implementations§
Source§impl GateTarget
impl GateTarget
Sourcepub fn new(
origin: CanonicalOrigin,
connect: Option<ConnectAddress>,
) -> Result<Self, CliError>
pub fn new( origin: CanonicalOrigin, connect: Option<ConnectAddress>, ) -> Result<Self, CliError>
Builds a target from --origin and the optional --connect.
§Errors
CliError::Usage when an https:// origin has no connect address
(the remote transport arrives with the public origin), when an
http:// origin without one is not itself on a loopback address, or
when the connect address has a path.
Sourcepub fn origin(&self) -> &CanonicalOrigin
pub fn origin(&self) -> &CanonicalOrigin
Returns the canonical origin requests are signed for.
Sourcepub fn connect(&self) -> &LoopbackUrl
pub fn connect(&self) -> &LoopbackUrl
Returns the loopback address requests are sent to.
Trait Implementations§
Source§impl Clone for GateTarget
impl Clone for GateTarget
Source§impl Debug for GateTarget
impl Debug for GateTarget
impl Eq for GateTarget
Source§impl PartialEq for GateTarget
impl PartialEq for GateTarget
impl StructuralPartialEq for GateTarget
Auto Trait Implementations§
impl Forget for GateTarget
impl Freeze for GateTarget
impl Move for GateTarget
impl RefUnwindSafe for GateTarget
impl Send for GateTargetwhere
RawVecInner: Send,
impl Sync for GateTargetwhere
RawVecInner: Sync,
impl Unpin for GateTarget
impl UnsafeUnpin for GateTarget
impl UnwindSafe for GateTargetwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.