summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsjlleo <[email protected]>2022-05-20 18:01:07 +0800
committersjlleo <[email protected]>2022-05-20 18:01:07 +0800
commit474ca966f5310052d5581672595432fdf01107b5 (patch)
treeb95387c970a0b59167be252d1e2edbffbfb764ab
parent997d7233dc0f07cefafd955ec19a829752cc44dd (diff)
Fix: Network Unreachable Reminderv3.0-Alpha.2
-rw-r--r--verify/ipv4.go6
-rw-r--r--verify/ipv6.go5
-rw-r--r--verify/verify.go1
3 files changed, 10 insertions, 2 deletions
diff --git a/verify/ipv4.go b/verify/ipv4.go
index 89e0cc9..6e086c9 100644
--- a/verify/ipv4.go
+++ b/verify/ipv4.go
@@ -20,7 +20,8 @@ func (v *IPv4Verifier) Execute() *VerifyResponse {
response.Type = 1
if v.IP, err = util.DnsResolver(4); err != nil {
- return &VerifyResponse{}
+ response.StatusCode = NetworkUnrachable
+ return &response
}
v.unblockTestChan = make(chan UnblockTestResult)
@@ -33,6 +34,9 @@ func (v *IPv4Verifier) Execute() *VerifyResponse {
for i := 0; i < 3; i++ {
switch res := <-v.unblockTestChan; {
+ case res.err != nil:
+ response.StatusCode = NetworkUnrachable
+
case res.CountryCode != "":
switch res.movieID {
case AreaAvailableID:
diff --git a/verify/ipv6.go b/verify/ipv6.go
index 07ff625..f6471b2 100644
--- a/verify/ipv6.go
+++ b/verify/ipv6.go
@@ -20,7 +20,7 @@ func (v *IPv6Verifier) Execute() *VerifyResponse {
response.Type = 2
if v.IP, err = util.DnsResolver(6); err != nil {
- response.StatusCode = -2
+ response.StatusCode = NetworkUnrachable
return &response
}
@@ -34,6 +34,9 @@ func (v *IPv6Verifier) Execute() *VerifyResponse {
for i := 0; i < 3; i++ {
switch res := <-v.unblockTestChan; {
+ case res.err != nil:
+ response.StatusCode = NetworkUnrachable
+
case res.CountryCode != "":
switch res.movieID {
case AreaAvailableID:
diff --git a/verify/verify.go b/verify/verify.go
index a657f3d..15b4f6b 100644
--- a/verify/verify.go
+++ b/verify/verify.go
@@ -5,6 +5,7 @@ var SelfMadeAvailableID = 80197526
var NonSelfMadeAvailableID = 70143836
const (
+ NetworkUnrachable = -2
AreaUnavailable = -1
AreaAvailable = 0
UnblockSelfMadeMovie = 1