summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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