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
942ff28e
Commit
942ff28e
authored
Dec 20, 2017
by
Yuxiang Zhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client-go: Fix broken TCP6 listen for port forwarding
The IPV6 loopback address `::1` is enclosed in square brackets twice, which cause a failure to listen on the TCP6 port.
parent
c273ad5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
portforward.go
...ing/src/k8s.io/client-go/tools/portforward/portforward.go
+2
-2
No files found.
staging/src/k8s.io/client-go/tools/portforward/portforward.go
View file @
942ff28e
...
...
@@ -185,7 +185,7 @@ func (pf *PortForwarder) forward() error {
// If both listener creation fail, an error is raised.
func
(
pf
*
PortForwarder
)
listenOnPort
(
port
*
ForwardedPort
)
error
{
errTcp4
:=
pf
.
listenOnPortAndAddress
(
port
,
"tcp4"
,
"127.0.0.1"
)
errTcp6
:=
pf
.
listenOnPortAndAddress
(
port
,
"tcp6"
,
"
[::1]
"
)
errTcp6
:=
pf
.
listenOnPortAndAddress
(
port
,
"tcp6"
,
"
::1
"
)
if
errTcp4
!=
nil
&&
errTcp6
!=
nil
{
return
fmt
.
Errorf
(
"All listeners failed to create with the following errors: %s, %s"
,
errTcp4
,
errTcp6
)
}
...
...
@@ -220,7 +220,7 @@ func (pf *PortForwarder) getListener(protocol string, hostname string, port *For
}
port
.
Local
=
uint16
(
localPortUInt
)
if
pf
.
out
!=
nil
{
fmt
.
Fprintf
(
pf
.
out
,
"Forwarding from %s
:%d -> %d
\n
"
,
hostname
,
localPortUInt
,
port
.
Remote
)
fmt
.
Fprintf
(
pf
.
out
,
"Forwarding from %s
-> %d
\n
"
,
net
.
JoinHostPort
(
hostname
,
strconv
.
Itoa
(
int
(
localPortUInt
)))
,
port
.
Remote
)
}
return
listener
,
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