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
ece79946
Commit
ece79946
authored
Feb 08, 2020
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
parent
94dcfcab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
forward.go
forward.go
+20
-4
No files found.
forward.go
View file @
ece79946
...
...
@@ -361,6 +361,10 @@ func TCPRemoteForwardListener(addr string, chain *Chain) (Listener, error) {
}
func
(
l
*
tcpRemoteForwardListener
)
isChainValid
()
bool
{
if
l
.
chain
.
IsEmpty
()
{
return
false
}
lastNode
:=
l
.
chain
.
LastNode
()
if
(
lastNode
.
Protocol
==
"forward"
&&
lastNode
.
Transport
==
"ssh"
)
||
lastNode
.
Protocol
==
"socks5"
||
lastNode
.
Protocol
==
""
{
...
...
@@ -429,7 +433,7 @@ func (l *tcpRemoteForwardListener) accept() (conn net.Conn, err error) {
return
l
.
chain
.
Dial
(
l
.
addr
.
String
())
}
if
l
astNode
.
Protocol
==
"socks5"
||
lastNode
.
Protocol
==
""
{
if
l
.
isChainValid
()
{
if
lastNode
.
GetBool
(
"mbind"
)
{
return
l
.
muxAccept
()
// multiplexing support for binding.
}
...
...
@@ -588,6 +592,8 @@ type udpRemoteForwardListener struct {
ln
*
net
.
UDPConn
ttl
time
.
Duration
closed
chan
struct
{}
ready
chan
struct
{}
once
sync
.
Once
closeMux
sync
.
Mutex
config
*
UDPListenConfig
}
...
...
@@ -613,18 +619,25 @@ func UDPRemoteForwardListener(addr string, chain *Chain, cfg *UDPListenConfig) (
chain
:
chain
,
connMap
:
new
(
udpConnMap
),
connChan
:
make
(
chan
net
.
Conn
,
backlog
),
ready
:
make
(
chan
struct
{}),
closed
:
make
(
chan
struct
{}),
config
:
cfg
,
}
go
ln
.
listenLoop
()
<-
ln
.
ready
return
ln
,
err
}
func
(
l
*
udpRemoteForwardListener
)
isChainValid
()
bool
{
if
l
.
chain
.
IsEmpty
()
{
return
false
}
lastNode
:=
l
.
chain
.
LastNode
()
return
lastNode
.
Protocol
==
"socks5"
return
lastNode
.
Protocol
==
"socks5"
||
lastNode
.
Protocol
==
""
}
func
(
l
*
udpRemoteForwardListener
)
listenLoop
()
{
...
...
@@ -635,6 +648,10 @@ func (l *udpRemoteForwardListener) listenLoop() {
return
}
l
.
once
.
Do
(
func
()
{
close
(
l
.
ready
)
})
func
()
{
defer
conn
.
Close
()
...
...
@@ -691,8 +708,7 @@ func (l *udpRemoteForwardListener) connect() (conn net.PacketConn, err error) {
default
:
}
lastNode
:=
l
.
chain
.
LastNode
()
if
lastNode
.
Protocol
==
"socks5"
||
lastNode
.
Protocol
==
""
{
if
l
.
isChainValid
()
{
var
cc
net
.
Conn
cc
,
err
=
getSocks5UDPTunnel
(
l
.
chain
,
l
.
addr
)
if
err
!=
nil
{
...
...
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