summaryrefslogtreecommitdiff
path: root/device/conn_default.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-03-03 05:01:06 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-04 16:37:11 +0100
commitb8e85267cf22528a96cefba5f86bac5958ce0c58 (patch)
treed6441205ba32a2ea5cb6f8c5dcba80a6387024dd /device/conn_default.go
parent69f0fe67b63d90e523a5a1241fb1b46c2e8dbe03 (diff)
downloadwireguard-go-b8e85267cf22528a96cefba5f86bac5958ce0c58.tar.gz
wireguard-go-b8e85267cf22528a96cefba5f86bac5958ce0c58.zip
boundif: introduce API for socket binding
Diffstat (limited to 'device/conn_default.go')
-rw-r--r--device/conn_default.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/device/conn_default.go b/device/conn_default.go
index 8a86719..820bb96 100644
--- a/device/conn_default.go
+++ b/device/conn_default.go
@@ -20,14 +20,14 @@ import (
* See conn_linux.go for an implementation on the linux platform.
*/
-type NativeBind struct {
+type nativeBind struct {
ipv4 *net.UDPConn
ipv6 *net.UDPConn
}
type NativeEndpoint net.UDPAddr
-var _ Bind = (*NativeBind)(nil)
+var _ Bind = (*nativeBind)(nil)
var _ Endpoint = (*NativeEndpoint)(nil)
func CreateEndpoint(s string) (Endpoint, error) {
@@ -100,7 +100,7 @@ func extractErrno(err error) error {
func CreateBind(uport uint16, device *Device) (Bind, uint16, error) {
var err error
- var bind NativeBind
+ var bind nativeBind
port := int(uport)
@@ -119,7 +119,7 @@ func CreateBind(uport uint16, device *Device) (Bind, uint16, error) {
return &bind, uint16(port), nil
}
-func (bind *NativeBind) Close() error {
+func (bind *nativeBind) Close() error {
var err1, err2 error
if bind.ipv4 != nil {
err1 = bind.ipv4.Close()
@@ -133,7 +133,7 @@ func (bind *NativeBind) Close() error {
return err2
}
-func (bind *NativeBind) ReceiveIPv4(buff []byte) (int, Endpoint, error) {
+func (bind *nativeBind) ReceiveIPv4(buff []byte) (int, Endpoint, error) {
if bind.ipv4 == nil {
return 0, nil, syscall.EAFNOSUPPORT
}
@@ -144,7 +144,7 @@ func (bind *NativeBind) ReceiveIPv4(buff []byte) (int, Endpoint, error) {
return n, (*NativeEndpoint)(endpoint), err
}
-func (bind *NativeBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) {
+func (bind *nativeBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) {
if bind.ipv6 == nil {
return 0, nil, syscall.EAFNOSUPPORT
}
@@ -152,7 +152,7 @@ func (bind *NativeBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) {
return n, (*NativeEndpoint)(endpoint), err
}
-func (bind *NativeBind) Send(buff []byte, endpoint Endpoint) error {
+func (bind *nativeBind) Send(buff []byte, endpoint Endpoint) error {
var err error
nend := endpoint.(*NativeEndpoint)
if nend.IP.To4() != nil {