Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
267885f1
Commit
267885f1
authored
Jan 03, 2020
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tun: support IPv6
parent
8e914c87
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
178 additions
and
98 deletions
+178
-98
go.mod
go.mod
+0
-1
go.sum
go.sum
+0
-2
tuntap.go
tuntap.go
+152
-89
tuntap_darwin.go
tuntap_darwin.go
+7
-2
tuntap_linux.go
tuntap_linux.go
+6
-1
tuntap_unix.go
tuntap_unix.go
+7
-2
tuntap_windows.go
tuntap_windows.go
+6
-1
No files found.
go.mod
View file @
267885f1
...
...
@@ -33,7 +33,6 @@ require (
github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735
github.com/shadowsocks/go-shadowsocks2 v0.0.11
github.com/shadowsocks/shadowsocks-go v0.0.0-20170121203516-97a5c71f80ba
github.com/songgao/packets v0.0.0-20160404182456-549a10cd4091
github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b // indirect
...
...
go.sum
View file @
267885f1
...
...
@@ -69,8 +69,6 @@ github.com/shadowsocks/go-shadowsocks2 v0.0.11 h1:dXloqEhYnZV40jblWTK8kWeC0Eb+dg
github.com/shadowsocks/go-shadowsocks2 v0.0.11/go.mod h1:R+KWaoIwRRhnpw6XV+dZil0XHi64Hc1D7hXUyXTjUzQ=
github.com/shadowsocks/shadowsocks-go v0.0.0-20170121203516-97a5c71f80ba h1:tJgNXb3S+RkB4kNPi6N5OmEWe3m+Y3Qs6LUMiNDAONM=
github.com/shadowsocks/shadowsocks-go v0.0.0-20170121203516-97a5c71f80ba/go.mod h1:mttDPaeLm87u74HMrP+n2tugXvIKWcwff/cqSX0lehY=
github.com/songgao/packets v0.0.0-20160404182456-549a10cd4091 h1:1zN6ImoqhSJhN8hGXFaJlSC8msLmIbX8bFqOfWLKw0w=
github.com/songgao/packets v0.0.0-20160404182456-549a10cd4091/go.mod h1:N20Z5Y8oye9a7HmytmZ+tr8Q2vlP0tAHP13kTHzwvQY=
github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b h1:+y4hCMc/WKsDbAPsOQZgBSaSZ26uh2afyaWeVg/3s/c=
github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU=
...
...
tuntap.go
View file @
267885f1
This diff is collapsed.
Click to expand it.
tuntap_darwin.go
View file @
267885f1
...
...
@@ -11,8 +11,8 @@ import (
"github.com/songgao/water"
)
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
pNet
*
net
.
IPNet
,
err
error
)
{
ip
,
ipNet
,
err
:=
net
.
ParseCIDR
(
cfg
.
Addr
)
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
tf
*
net
.
Interface
,
err
error
)
{
ip
,
_
,
err
:=
net
.
ParseCIDR
(
cfg
.
Addr
)
if
err
!=
nil
{
return
}
...
...
@@ -41,6 +41,11 @@ func createTun(cfg TunConfig) (conn net.Conn, ipNet *net.IPNet, err error) {
return
}
itf
,
err
=
net
.
InterfaceByName
(
ifce
.
Name
())
if
err
!=
nil
{
return
}
conn
=
&
tunTapConn
{
ifce
:
ifce
,
addr
:
&
net
.
IPAddr
{
IP
:
ip
},
...
...
tuntap_linux.go
View file @
267885f1
...
...
@@ -10,7 +10,7 @@ import (
"github.com/songgao/water"
)
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
pNet
*
net
.
IPNet
,
err
error
)
{
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
tf
*
net
.
Interface
,
err
error
)
{
ip
,
ipNet
,
err
:=
net
.
ParseCIDR
(
cfg
.
Addr
)
if
err
!=
nil
{
return
...
...
@@ -61,6 +61,11 @@ func createTun(cfg TunConfig) (conn net.Conn, ipNet *net.IPNet, err error) {
return
}
itf
,
err
=
net
.
InterfaceByName
(
ifce
.
Name
())
if
err
!=
nil
{
return
}
conn
=
&
tunTapConn
{
ifce
:
ifce
,
addr
:
&
net
.
IPAddr
{
IP
:
ip
},
...
...
tuntap_unix.go
View file @
267885f1
...
...
@@ -12,8 +12,8 @@ import (
"github.com/songgao/water"
)
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
pNet
*
net
.
IPNet
,
err
error
)
{
ip
,
ipNet
,
err
:=
net
.
ParseCIDR
(
cfg
.
Addr
)
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
tf
*
net
.
Interface
,
err
error
)
{
ip
,
_
,
err
:=
net
.
ParseCIDR
(
cfg
.
Addr
)
if
err
!=
nil
{
return
}
...
...
@@ -42,6 +42,11 @@ func createTun(cfg TunConfig) (conn net.Conn, ipNet *net.IPNet, err error) {
return
}
itf
,
err
=
net
.
InterfaceByName
(
ifce
.
Name
())
if
err
!=
nil
{
return
}
conn
=
&
tunTapConn
{
ifce
:
ifce
,
addr
:
&
net
.
IPAddr
{
IP
:
ip
},
...
...
tuntap_windows.go
View file @
267885f1
...
...
@@ -10,7 +10,7 @@ import (
"github.com/songgao/water"
)
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
pNet
*
net
.
IPNet
,
err
error
)
{
func
createTun
(
cfg
TunConfig
)
(
conn
net
.
Conn
,
i
tf
*
net
.
Interface
,
err
error
)
{
ip
,
ipNet
,
err
:=
net
.
ParseCIDR
(
cfg
.
Addr
)
if
err
!=
nil
{
return
...
...
@@ -42,6 +42,11 @@ func createTun(cfg TunConfig) (conn net.Conn, ipNet *net.IPNet, err error) {
return
}
itf
,
err
=
net
.
InterfaceByName
(
ifce
.
Name
())
if
err
!=
nil
{
return
}
conn
=
&
tunTapConn
{
ifce
:
ifce
,
addr
:
&
net
.
IPAddr
{
IP
:
ip
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment