aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-11-17 19:52:40 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-11-17 19:52:40 +0100
commit64707b0471b5efe06ac2c93e350676d9d4049b72 (patch)
tree04276f7085fa90e4470986da1d66ce44faa4b24d /src/platform
parentUpdate UAPI semantics for remove (diff)
downloadwireguard-rs-64707b0471b5efe06ac2c93e350676d9d4049b72.tar.xz
wireguard-rs-64707b0471b5efe06ac2c93e350676d9d4049b72.zip
Update configuration API
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/bind.rs2
-rw-r--r--src/platform/dummy/bind.rs4
-rw-r--r--src/platform/linux/uapi.rs2
-rw-r--r--src/platform/linux/udp.rs6
-rw-r--r--src/platform/uapi.rs2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/platform/bind.rs b/src/platform/bind.rs
index 1055f37..9487dfd 100644
--- a/src/platform/bind.rs
+++ b/src/platform/bind.rs
@@ -32,7 +32,7 @@ pub trait Owner: Send {
fn get_fwmark(&self) -> Option<u32>;
- fn set_fwmark(&mut self, value: Option<u32>) -> Option<Self::Error>;
+ fn set_fwmark(&mut self, value: Option<u32>) -> Result<(), Self::Error>;
}
/// On some platforms the application can itself bind to a socket.
diff --git a/src/platform/dummy/bind.rs b/src/platform/dummy/bind.rs
index b42483a..d69e6a4 100644
--- a/src/platform/dummy/bind.rs
+++ b/src/platform/dummy/bind.rs
@@ -203,8 +203,8 @@ impl Bind for PairBind {
impl Owner for VoidOwner {
type Error = BindError;
- fn set_fwmark(&mut self, _value: Option<u32>) -> Option<Self::Error> {
- None
+ fn set_fwmark(&mut self, _value: Option<u32>) -> Result<(), Self::Error> {
+ Ok(())
}
fn get_port(&self) -> u16 {
diff --git a/src/platform/linux/uapi.rs b/src/platform/linux/uapi.rs
index fdf2bf0..107745a 100644
--- a/src/platform/linux/uapi.rs
+++ b/src/platform/linux/uapi.rs
@@ -24,7 +24,7 @@ impl BindUAPI for UnixListener {
type Stream = UnixStream;
type Error = io::Error;
- fn accept(&self) -> Result<UnixStream, io::Error> {
+ fn connect(&self) -> Result<UnixStream, io::Error> {
let (stream, _) = self.accept()?;
Ok(stream)
}
diff --git a/src/platform/linux/udp.rs b/src/platform/linux/udp.rs
index d3d61b6..a291d1a 100644
--- a/src/platform/linux/udp.rs
+++ b/src/platform/linux/udp.rs
@@ -43,15 +43,15 @@ impl Owner for LinuxOwner {
type Error = io::Error;
fn get_port(&self) -> u16 {
- 1337
+ self.0.local_addr().unwrap().port() // todo handle
}
fn get_fwmark(&self) -> Option<u32> {
None
}
- fn set_fwmark(&mut self, value: Option<u32>) -> Option<Self::Error> {
- None
+ fn set_fwmark(&mut self, _value: Option<u32>) -> Result<(), Self::Error> {
+ Ok(())
}
}
diff --git a/src/platform/uapi.rs b/src/platform/uapi.rs
index 6922a9c..8259f67 100644
--- a/src/platform/uapi.rs
+++ b/src/platform/uapi.rs
@@ -5,7 +5,7 @@ pub trait BindUAPI {
type Stream: Read + Write;
type Error: Error;
- fn accept(&self) -> Result<Self::Stream, Self::Error>;
+ fn connect(&self) -> Result<Self::Stream, Self::Error>;
}
pub trait PlatformUAPI {