summaryrefslogtreecommitdiff
path: root/protocol/src/address.rs
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/src/address.rs')
-rw-r--r--protocol/src/address.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/protocol/src/address.rs b/protocol/src/address.rs
new file mode 100644
index 0000000..ab49df4
--- /dev/null
+++ b/protocol/src/address.rs
@@ -0,0 +1,56 @@
+use crate::protocol::BasicProtocol;
+use std::marker::PhantomData;
+
+/// Upstream, used by Workspace to describe the protocol of UpstreamVault
+pub struct Upstream<Protocol>
+where
+ Protocol: BasicProtocol,
+{
+ /// Protocol of the target upstream machine
+ _p: PhantomData<Protocol>,
+
+ /// Address of the target upstream machine
+ target_address: String,
+}
+
+impl<Protocol> Upstream<Protocol>
+where
+ Protocol: BasicProtocol,
+{
+ pub fn new(addr: &str) -> Self {
+ Upstream {
+ _p: PhantomData,
+ target_address: addr.to_string(),
+ }
+ }
+}
+
+/// Host, used by Vault to describe its own protocol
+pub struct Host<Protocol>
+where
+ Protocol: BasicProtocol,
+{
+ /// Protocol of the target upstream machine
+ _p: PhantomData<Protocol>,
+}
+
+impl<Protocol> Upstream<Protocol>
+where
+ Protocol: BasicProtocol,
+{
+ pub fn address(addr: &str) -> Self {
+ Upstream {
+ _p: PhantomData,
+ target_address: addr.to_string(),
+ }
+ }
+}
+
+impl<Protocol> Host<Protocol>
+where
+ Protocol: BasicProtocol,
+{
+ pub fn new() -> Self {
+ Host { _p: PhantomData }
+ }
+}