summaryrefslogtreecommitdiff
path: root/printer/printer.go
blob: 61b447243becb211aa14fb24544ab7851605e997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package printer

import (
	"fmt"

	"github.com/sjlleo/netflix-verify/verify"
)

const (
	AUTHOR        = "@sjlleo"
	VERSION       = "v3.0"
	RED_PREFIX    = "\033[1;31m"
	GREEN_PREFIX  = "\033[1;32m"
	YELLOW_PREFIX = "\033[1;33m"
	BLUE_PREFIX   = "\033[1;34m"
	PURPLE_PREFIX = "\033[1;35m"
	CYAN_PREFIX   = "\033[1;36m"
	RESET_PREFIX  = "\033[0m"
)

func Print(fr verify.FinalResult) {
	printVersion()
	printResult("4", fr.Res[1])
	fmt.Println()
	printResult("6", fr.Res[2])
}

func printVersion() {
	fmt.Println("**NetFlix 解锁检测小工具 " + VERSION + " By " + CYAN_PREFIX + AUTHOR + RESET_PREFIX + "**")
}

func printResult(ipVersion string, vResponse verify.VerifyResponse) {
	fmt.Printf("[IPv%s]\n", ipVersion)
	switch code := vResponse.StatusCode; {
	case code < -1:
		fmt.Println(RED_PREFIX + "您的网络可能没有正常配置IPv" + ipVersion + ",或者没有IPv" + ipVersion + "网络接入" + RESET_PREFIX)
	case code == -1:
		fmt.Println(RED_PREFIX + "Netflix在您的出口IP所在的国家不提供服务" + RESET_PREFIX)
	case code == 0:
		fmt.Println(RED_PREFIX + "Netflix在您的出口IP所在的国家提供服务,但是您的IP疑似代理,无法正常使用服务" + RESET_PREFIX)
		fmt.Println(CYAN_PREFIX + "NF所识别的IP地域信息:" + vResponse.CountryName + RESET_PREFIX)
	case code == 1:
		fmt.Println(YELLOW_PREFIX + "您的出口IP可以使用Netflix,但仅可看Netflix自制剧" + RESET_PREFIX)
		fmt.Println(CYAN_PREFIX + "NF所识别的IP地域信息:" + vResponse.CountryName + RESET_PREFIX)
	case code == 2:
		fmt.Println(GREEN_PREFIX + "您的出口IP完整解锁Netflix,支持非自制剧的观看" + RESET_PREFIX)
		fmt.Println(CYAN_PREFIX + "NF所识别的IP地域信息:" + vResponse.CountryName + RESET_PREFIX)
	case code == 3:
		fmt.Println(YELLOW_PREFIX + "您的出口IP无法观看此电影" + RESET_PREFIX)
	case code == 4:
		fmt.Println(GREEN_PREFIX + "您的出口IP可以观看此电影" + RESET_PREFIX)
		fmt.Println(CYAN_PREFIX + "NF所识别的IP地域信息:" + vResponse.CountryName + RESET_PREFIX)
	default:
		fmt.Println(YELLOW_PREFIX + "解锁检测失败,请稍后重试" + RESET_PREFIX)
	}
}