blob: c2555b86272365a3b6ee21d54fa0dba2525b746f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2017-2020 WireGuard LLC. All Rights Reserved.
*/
package device
import (
"errors"
"golang.zx2c4.com/wireguard/conn"
)
// TODO(crawshaw): this method is a compatibility shim. Replace with direct use of conn.
func (device *Device) BindSocketToInterface4(interfaceIndex uint32, blackhole bool) error {
if device.net.bind == nil {
return errors.New("Bind is not yet initialized")
}
if iface, ok := device.net.bind.(conn.BindToInterface); ok {
return iface.BindToInterface4(interfaceIndex, blackhole)
}
return nil
}
// TODO(crawshaw): this method is a compatibility shim. Replace with direct use of conn.
func (device *Device) BindSocketToInterface6(interfaceIndex uint32, blackhole bool) error {
if device.net.bind == nil {
return errors.New("Bind is not yet initialized")
}
if iface, ok := device.net.bind.(conn.BindToInterface); ok {
return iface.BindToInterface6(interfaceIndex, blackhole)
}
return nil
}
|