summaryrefslogtreecommitdiffhomepage
path: root/src/conn_linux.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-10-16 21:33:47 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-10-16 21:33:47 +0200
commite86d03dca23e5adcbd1c7bd30157bc7d19a932d7 (patch)
tree5792ecf8bad5a76c96033ceeef32a91df7d344b2 /src/conn_linux.go
parenta72b0f7ae5dda27d839bb317b7c01d11b215e77a (diff)
Initial implementation of source caching
Yet untested.
Diffstat (limited to 'src/conn_linux.go')
-rw-r--r--src/conn_linux.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/conn_linux.go b/src/conn_linux.go
index 8942b03..4a5a3f0 100644
--- a/src/conn_linux.go
+++ b/src/conn_linux.go
@@ -133,7 +133,7 @@ func sockaddrToString(addr unix.RawSockaddrInet6) string {
}
}
-func (end *Endpoint) DestinationIP() net.IP {
+func (end *Endpoint) DstIP() net.IP {
switch end.dst.Family {
case unix.AF_INET6:
return end.dst.Addr[:]
@@ -150,20 +150,24 @@ func (end *Endpoint) DestinationIP() net.IP {
}
}
-func (end *Endpoint) SourceToBytes() []byte {
+func (end *Endpoint) SrcToBytes() []byte {
ptr := unsafe.Pointer(&end.src)
arr := (*[unix.SizeofSockaddrInet6]byte)(ptr)
return arr[:]
}
-func (end *Endpoint) SourceToString() string {
+func (end *Endpoint) SrcToString() string {
return sockaddrToString(end.src)
}
-func (end *Endpoint) DestinationToString() string {
+func (end *Endpoint) DstToString() string {
return sockaddrToString(end.dst)
}
+func (end *Endpoint) ClearDst() {
+ end.dst = unix.RawSockaddrInet6{}
+}
+
func (end *Endpoint) ClearSrc() {
end.src = unix.RawSockaddrInet6{}
}