Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3592d0bd
Unverified
Commit
3592d0bd
authored
Jan 27, 2020
by
Erik Wilson
Committed by
GitHub
Jan 27, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1344 from ibuildthecloud/dialer-fallback
If tunnel session does not exist fallback to default dialer
parents
1a2690d7
3396a7b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
tunnel.go
pkg/daemons/control/tunnel.go
+6
-2
No files found.
pkg/daemons/control/tunnel.go
View file @
3592d0bd
...
...
@@ -21,14 +21,18 @@ func setupTunnel() http.Handler {
}
func
setupProxyDialer
(
tunnelServer
*
remotedialer
.
Server
)
{
app
.
DefaultProxyDialerFn
=
utilnet
.
DialFunc
(
func
(
_
context
.
Context
,
network
,
address
string
)
(
net
.
Conn
,
error
)
{
app
.
DefaultProxyDialerFn
=
utilnet
.
DialFunc
(
func
(
ctx
context
.
Context
,
network
,
address
string
)
(
net
.
Conn
,
error
)
{
_
,
port
,
_
:=
net
.
SplitHostPort
(
address
)
addr
:=
"127.0.0.1"
if
port
!=
""
{
addr
+=
":"
+
port
}
nodeName
,
_
:=
kv
.
Split
(
address
,
":"
)
return
tunnelServer
.
Dial
(
nodeName
,
15
*
time
.
Second
,
"tcp"
,
addr
)
if
tunnelServer
.
HasSession
(
nodeName
)
{
return
tunnelServer
.
Dial
(
nodeName
,
15
*
time
.
Second
,
"tcp"
,
addr
)
}
var
d
net
.
Dialer
return
d
.
DialContext
(
ctx
,
network
,
address
)
})
}
...
...
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