diff options
Diffstat (limited to 'verify/ipv6.go')
-rw-r--r-- | verify/ipv6.go | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/verify/ipv6.go b/verify/ipv6.go index 05083c7..2da879d 100644 --- a/verify/ipv6.go +++ b/verify/ipv6.go @@ -27,28 +27,42 @@ func (v *IPv6Verifier) Execute() *VerifyResponse { v.unblockTestChan = make(chan UnblockTestResult) defer close(v.unblockTestChan) - go v.UnblockTest(AreaAvailableID) - go v.UnblockTest(SelfMadeAvailableID) - go v.UnblockTest(NonSelfMadeAvailableID) + if v.Custom == "" { + go v.UnblockTest(AreaAvailableID) + go v.UnblockTest(SelfMadeAvailableID) + go v.UnblockTest(NonSelfMadeAvailableID) - for i := 0; i < 3; i++ { - switch res := <-v.unblockTestChan; { + for i := 0; i < 3; i++ { + switch res := <-v.unblockTestChan; { - case res.err != nil: - v.unblockStatus = NetworkUnrachable + case res.err != nil: + v.unblockStatus = NetworkUnrachable - case res.CountryCode != "": - switch res.movieID { - case AreaAvailableID: - v.upgradeStatus(AreaAvailable) - case SelfMadeAvailableID: - v.upgradeStatus(UnblockSelfMadeMovie) - case NonSelfMadeAvailableID: - v.upgradeStatus(UnblockNonSelfMadeMovie) + case res.CountryCode != "": + switch res.movieID { + case AreaAvailableID: + v.upgradeStatus(AreaAvailable) + case SelfMadeAvailableID: + v.upgradeStatus(UnblockSelfMadeMovie) + case NonSelfMadeAvailableID: + v.upgradeStatus(UnblockNonSelfMadeMovie) + } + response.CountryCode = res.CountryCode + response.CountryName = util.CountryCodeToCountryName(res.CountryCode) + default: } + } + } else { + if customMovieID, err := strconv.Atoi(v.Custom); err == nil { + go v.UnblockTest(customMovieID) + } + res := <-v.unblockTestChan + if res.CountryCode != "" { + v.unblockStatus = CustomMovieUnblock response.CountryCode = res.CountryCode response.CountryName = util.CountryCodeToCountryName(res.CountryCode) - default: + } else { + v.unblockStatus = CustomMovieBlock } } response.StatusCode = v.unblockStatus @@ -63,7 +77,7 @@ func (v *IPv6Verifier) upgradeStatus(status int) { func (v *IPv6Verifier) UnblockTest(MoiveID int) { - testURL := util.Netflix + strconv.Itoa(MoiveID) + testURL := NetflixURL_PREFIX + strconv.Itoa(MoiveID) if reCode, err := util.RequestIP(testURL, v.IP, v.LocalAddr); err != nil { if err.Error() == "Banned" { v.unblockTestChan <- UnblockTestResult{MoiveID, "", nil} |