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
7c2a5faa
Commit
7c2a5faa
authored
Nov 01, 2017
by
rui.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug #160
parent
d3b5ff24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
cmd/gost/main.go
cmd/gost/main.go
+3
-0
ssh.go
ssh.go
+10
-5
No files found.
cmd/gost/main.go
View file @
7c2a5faa
...
...
@@ -214,11 +214,14 @@ func initChain() (*gost.Chain, error) {
)
interval
,
_
:=
strconv
.
Atoi
(
node
.
Values
.
Get
(
"ping"
))
retry
,
_
:=
strconv
.
Atoi
(
node
.
Values
.
Get
(
"retry"
))
node
.
HandshakeOptions
=
append
(
node
.
HandshakeOptions
,
gost
.
AddrHandshakeOption
(
node
.
Addr
),
gost
.
UserHandshakeOption
(
node
.
User
),
gost
.
TLSConfigHandshakeOption
(
tlsCfg
),
gost
.
IntervalHandshakeOption
(
time
.
Duration
(
interval
)
*
time
.
Second
),
gost
.
TimeoutHandshakeOption
(
time
.
Duration
(
timeout
)
*
time
.
Second
),
gost
.
RetryHandshakeOption
(
retry
),
)
node
.
Client
=
&
gost
.
Client
{
Connector
:
connector
,
...
...
ssh.go
View file @
7c2a5faa
...
...
@@ -185,7 +185,7 @@ func (tr *sshForwardTransporter) Handshake(conn net.Conn, options ...HandshakeOp
connChan
:
make
(
chan
net
.
Conn
,
1024
),
}
tr
.
sessions
[
opts
.
Addr
]
=
session
go
session
.
Ping
(
opts
.
Interval
,
opts
.
Timeout
,
1
)
go
session
.
Ping
(
opts
.
Interval
,
opts
.
Timeout
,
opts
.
Retry
)
go
session
.
waitServer
()
go
session
.
waitClose
()
}
...
...
@@ -280,7 +280,7 @@ func (tr *sshTunnelTransporter) Handshake(conn net.Conn, options ...HandshakeOpt
deaded
:
make
(
chan
struct
{}),
}
tr
.
sessions
[
opts
.
Addr
]
=
session
go
session
.
Ping
(
opts
.
Interval
,
30
*
time
.
Second
,
1
)
go
session
.
Ping
(
opts
.
Interval
,
opts
.
Timeout
,
opts
.
Retry
)
go
session
.
waitServer
()
go
session
.
waitClose
()
}
...
...
@@ -317,11 +317,16 @@ func (s *sshSession) Ping(interval, timeout time.Duration, retries int) {
return
}
if
timeout
<=
0
{
timeout
=
0
timeout
=
10
*
time
.
Second
}
if
retries
==
0
{
retries
=
1
}
defer
close
(
s
.
deaded
)
log
.
Log
(
"[ssh] ping is enabled, interval:"
,
interval
)
log
.
Log
f
(
"[ssh] ping is enabled, interval: %v, timeout: %v, retry: %d"
,
interval
,
timeout
,
retries
)
baseCtx
:=
context
.
Background
()
t
:=
time
.
NewTicker
(
interval
)
defer
t
.
Stop
()
...
...
@@ -453,7 +458,7 @@ func (h *sshForwardHandler) handleForward(conn ssh.Conn, chans <-chan ssh.NewCha
case
RemoteForwardRequest
:
go
h
.
tcpipForwardRequest
(
conn
,
req
,
quit
)
default
:
// log.Log("[ssh] unknown
channel type:", req.Type
)
// log.Log("[ssh] unknown
request type:", req.Type, req.WantReply
)
if
req
.
WantReply
{
req
.
Reply
(
false
,
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