Skip to content

Commit

Permalink
style(config): better messages for the 1.1.1.1/1.0.0.1 switch (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
favonia committed May 20, 2023
1 parent 8b9d160 commit 4524153
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions internal/config/network_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@ func ProbeURL(ctx context.Context, url string) bool {

// ShouldWeUse1001 quickly checks 1.1.1.1 and 1.0.0.1 and return whether 1.0.0.1 should be used.
func ShouldWeUse1001(ctx context.Context, ppfmt pp.PP) bool {
good1111 := ProbeURL(ctx, "https://1.1.1.1")
good1001 := ProbeURL(ctx, "https://1.0.0.1")

if !good1111 && good1001 {
ppfmt.Warningf(pp.EmojiError, "1.1.1.1 might have been blocked or intercepted by your ISP or your router")
ppfmt.Warningf(pp.EmojiError, "1.0.0.1 seems to work and will be used instead")
if !ProbeURL(ctx, "https://1.1.1.1") && ProbeURL(ctx, "https://1.0.0.1") {
ppfmt.Warningf(pp.EmojiError, "1.1.1.1 appears to be blocked or intercepted by your ISP or your router")
ppfmt.Warningf(pp.EmojiGood, "1.0.0.1 seems to work and will be used instead of 1.1.1.1 for IPv4 address detection")
return true
}

Expand Down

0 comments on commit 4524153

Please sign in to comment.