mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 06:35:07 +03:00
Define generic adapter type, rename tunDevice to tunAdapter
This commit is contained in:
parent
f28360ce4d
commit
8045cb4dc3
8 changed files with 25 additions and 24 deletions
|
@ -13,7 +13,7 @@ import (
|
|||
// Configures the TAP adapter with the correct IPv6 address and MTU. On Windows
|
||||
// we don't make use of a direct operating system API to do this - we instead
|
||||
// delegate the hard work to "netsh".
|
||||
func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int) error {
|
||||
func (tun *tunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int) error {
|
||||
if !iftapmode {
|
||||
tun.core.log.Printf("TUN mode is not supported on this platform, defaulting to TAP")
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int)
|
|||
}
|
||||
|
||||
// Sets the MTU of the TAP adapter.
|
||||
func (tun *tunDevice) setupMTU(mtu int) error {
|
||||
func (tun *tunAdapter) setupMTU(mtu int) error {
|
||||
// Set MTU
|
||||
cmd := exec.Command("netsh", "interface", "ipv6", "set", "subinterface",
|
||||
fmt.Sprintf("interface=%s", tun.iface.Name()),
|
||||
|
@ -82,7 +82,7 @@ func (tun *tunDevice) setupMTU(mtu int) error {
|
|||
}
|
||||
|
||||
// Sets the IPv6 address of the TAP adapter.
|
||||
func (tun *tunDevice) setupAddress(addr string) error {
|
||||
func (tun *tunAdapter) setupAddress(addr string) error {
|
||||
// Set address
|
||||
cmd := exec.Command("netsh", "interface", "ipv6", "add", "address",
|
||||
fmt.Sprintf("interface=%s", tun.iface.Name()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue