mirror of
https://github.com/fumiama/water.git
synced 2026-06-28 16:00:26 +08:00
add mod
This commit is contained in:
8
go.mod
Normal file
8
go.mod
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
module github.com/fumiama/water
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
|
||||||
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
|
||||||
|
)
|
||||||
4
go.sum
Normal file
4
go.sum
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 h1:TG/diQgUe0pntT/2D9tmUCz4VNwm9MfrtPr0SU2qSX8=
|
||||||
|
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E=
|
||||||
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
|
||||||
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
@@ -28,7 +28,7 @@ type PlatformSpecificParams struct {
|
|||||||
|
|
||||||
func defaultPlatformSpecificParams() PlatformSpecificParams {
|
func defaultPlatformSpecificParams() PlatformSpecificParams {
|
||||||
return PlatformSpecificParams{
|
return PlatformSpecificParams{
|
||||||
ComponentID: "tap0901",
|
ComponentID: "root\\tap0901",
|
||||||
Network: "192.168.1.10/24",
|
Network: "192.168.1.10/24",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,11 +281,6 @@ func openDev(config Config) (ifce *Interface, err error) {
|
|||||||
fd := &wfile{fd: file, ro: ro, wo: wo}
|
fd := &wfile{fd: file, ro: ro, wo: wo}
|
||||||
ifce = &Interface{isTAP: (config.DeviceType == TAP), ReadWriteCloser: fd}
|
ifce = &Interface{isTAP: (config.DeviceType == TAP), ReadWriteCloser: fd}
|
||||||
|
|
||||||
// bring up device.
|
|
||||||
if err := setStatus(file, true); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
//TUN
|
//TUN
|
||||||
if config.DeviceType == TUN {
|
if config.DeviceType == TUN {
|
||||||
if err := setTUN(file, config.PlatformSpecificParams.Network); err != nil {
|
if err := setTUN(file, config.PlatformSpecificParams.Network); err != nil {
|
||||||
@@ -293,6 +288,11 @@ func openDev(config Config) (ifce *Interface, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bring up device.
|
||||||
|
if err := setStatus(file, true); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// find the name of tap interface(u need it to set the ip or other command)
|
// find the name of tap interface(u need it to set the ip or other command)
|
||||||
ifces, err := net.Interfaces()
|
ifces, err := net.Interfaces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user