Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5659ea0

Browse files
committed
fixup! fix: detect JetBrains running on local ipv6
1 parent4e5f54c commit5659ea0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎agent/agentssh/portinspection_supported.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ func getListeningPortProcessCmdline(port uint32) (string, error) {
1515
acceptFn:=func(s*netstat.SockTabEntry)bool {
1616
returns.LocalAddr!=nil&&uint32(s.LocalAddr.Port)==port
1717
}
18-
tabs,err:=netstat.TCPSocks(acceptFn)
18+
tabs,err4:=netstat.TCPSocks(acceptFn)
1919
tabs6,err6:=netstat.TCP6Socks(acceptFn)
2020

21-
// Only return the error if the other method found nothing.
22-
if (err!=nil&&len(tabs6)==0)|| (err6!=nil&&len(tabs)==0) {
23-
return"",xerrors.Errorf("inspect port %d: %w",port,errors.Join(err,err6))
21+
// In the common case, we want to check ipv4 listening addresses. If this
22+
// fails, we should return an error. We also need to check ipv6. The
23+
// assumption is, if we have an err4, and 0 ipv6 addresses listed, then we are
24+
// interested in the err4 (and vice versa). So return both errors (at least 1
25+
// is non-nil) if the other list is empty.
26+
if (err4!=nil&&len(tabs6)==0)|| (err6!=nil&&len(tabs)==0) {
27+
return"",xerrors.Errorf("inspect port %d: %w",port,errors.Join(err4,err6))
2428
}
2529

2630
varproc*netstat.Process

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp