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

Commit41ab80f

Browse files
committed
review 2
1 parent416b5ff commit41ab80f

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

‎cli/cliui/agent.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,9 @@ func ConnDiagnostics(w io.Writer, d ConnDiags) {
377377

378378
ifd.PingP2P {
379379
_,_=fmt.Fprint(w,"✔ You are connected directly (p2p)\n")
380+
}else {
381+
_,_=fmt.Fprint(w,"❗ You are connected via a DERP relay, not directly (p2p)\n")
380382
}
381-
_,_=fmt.Fprint(w,"❗ You are connected via a DERP relay, not directly (p2p)\n")
382383

383384
ifd.DisableDirect {
384385
_,_=fmt.Fprint(w,"❗ Direct connections are disabled locally, by `--disable-direct` or `CODER_DISABLE_DIRECT`\n")

‎cli/cliutil/awscheck.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func FetchAWSIPRanges(ctx context.Context, url string) (*AWSIPRanges, error) {
7171
iferr!=nil {
7272
returnnil,xerrors.Errorf("parse ip prefix: %w",err)
7373
}
74+
ifprefix.Addr().Is6() {
75+
returnnil,xerrors.Errorf("ipv4 prefix contains ipv6 address: %s",p.Prefix)
76+
}
7477
out.V4=append(out.V4,prefix)
7578
}
7679

@@ -79,6 +82,9 @@ func FetchAWSIPRanges(ctx context.Context, url string) (*AWSIPRanges, error) {
7982
iferr!=nil {
8083
returnnil,xerrors.Errorf("parse ip prefix: %w",err)
8184
}
85+
ifprefix.Addr().Is4() {
86+
returnnil,xerrors.Errorf("ipv6 prefix contains ipv4 address: %s",p.Prefix)
87+
}
8288
out.V6=append(out.V6,prefix)
8389
}
8490

‎cli/ping.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,17 @@ func (r *RootCmd) ping() *serpent.Command {
224224
}
225225

226226
funcisAWSIP(awsRanges*cliutil.AWSIPRanges,ni*tailcfg.NetInfo)bool {
227-
checkIP:=func(ipStrstring)bool {
228-
ip,err:=netip.ParseAddr(ipStr)
229-
returnerr==nil&&awsRanges.CheckIP(ip)
227+
ifni.GlobalV4!="" {
228+
ip,err:=netip.ParseAddr(ni.GlobalV4)
229+
iferr==nil&&awsRanges.CheckIP(ip) {
230+
returntrue
231+
}
230232
}
231-
232-
returncheckIP(ni.GlobalV4)||checkIP(ni.GlobalV6)
233+
ifni.GlobalV6!="" {
234+
ip,err:=netip.ParseAddr(ni.GlobalV6)
235+
iferr==nil&&awsRanges.CheckIP(ip) {
236+
returntrue
237+
}
238+
}
239+
returnfalse
233240
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp