From f0950f07a02d3b65c881e91e3a5329bd1522dd69 Mon Sep 17 00:00:00 2001 From: "kingparks@jeter.eu.org" <1570967070@qq.com> Date: Tue, 27 Aug 2024 17:35:54 +0800 Subject: [PATCH] first commit --- .gitignore | 1 + README.md | 26 ++++ README_CN.md | 26 ++++ build.sh | 22 +++ build/install.sh | 95 +++++++++++++ go.mod | 66 +++++++++ go.sum | 311 ++++++++++++++++++++++++++++++++++++++++++ main.go | 26 ++++ rsrc.ico | Bin 0 -> 15406 bytes tui/client.go | 137 +++++++++++++++++++ tui/locales/en.ini | 25 ++++ tui/locales/es.ini | 24 ++++ tui/locales/hu.ini | 24 ++++ tui/locales/nl.ini | 24 ++++ tui/locales/ru.ini | 24 ++++ tui/locales/tr.ini | 24 ++++ tui/setProxy_linux.go | 12 ++ tui/setProxy_mac.go | 41 ++++++ tui/setProxy_win.go | 40 ++++++ tui/tui.go | 298 ++++++++++++++++++++++++++++++++++++++++ 20 files changed, 1246 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 README_CN.md create mode 100644 build.sh create mode 100755 build/install.sh create mode 100644 go.mod create mode 100644 go.sum create mode 100644 main.go create mode 100644 rsrc.ico create mode 100644 tui/client.go create mode 100644 tui/locales/en.ini create mode 100644 tui/locales/es.ini create mode 100644 tui/locales/hu.ini create mode 100644 tui/locales/nl.ini create mode 100644 tui/locales/ru.ini create mode 100644 tui/locales/tr.ini create mode 100644 tui/setProxy_linux.go create mode 100644 tui/setProxy_mac.go create mode 100644 tui/setProxy_win.go create mode 100644 tui/tui.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9bf6b2c --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# cursor-vip + +[中文](./README_CN.md) + +`cursor-vip` is a tool service for CURSOR smart code editor to enjoy VIP intelligent prompts without logging in. + + +### Usage +Install cursor-vip: +```bash +bash <(curl https://mirror.ghproxy.com/https://github.com/kingparks/cursor-vip/releases/download/latest/install.sh) githubReadme +``` + +Launch cursor-vip: +```bash +cursor-vip +``` +For the first time after starting, you need to install the trusted certificate. The certificate will be automatically generated after the first start command, and the path is `~/.cursor-vip/cursor-vip-ca-cert.pem`. +* MacOS: Execute `open ~/.cursor-vip` in the terminal, double-click the cursor-vip-ca-cert.pem file, pop up the "Keychain Access" window, select the certificate, search for cursor-vip, double-click cursor-vip, expand trust, select "Always trust when using this certificate", close the pop-up window, enter the password to confirm, and the certificate is installed. +* Windows: Search for cer in windows, select the `certmgr.msc` function, expand `Trusted Root Certification Authorities`, select `Certificates`, right-click `All Tasks`, select `Import`, next, enter the `%homepath%\.cursor-vip\cursor-vip-ca-cert.pem` file, next all the way, complete; reopen the browser. +* Linux: //TODO + +Enjoy cursor-vip: +* Open the CURSOR code editor, click the settings icon in the upper right corner, exit and log in to enjoy + + diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 0000000..0645253 --- /dev/null +++ b/README_CN.md @@ -0,0 +1,26 @@ +# cursor-vip + +[English](./README.md) + +`cursor-vip` 是一个用于 CURSOR 智能代码编辑器 无需账号登录即可享受VIP智能提示的工具服务。 + + +### 使用 +安装 cursor-vip: +```bash +bash <(curl https://mirror.ghproxy.com/https://github.com/kingparks/cursor-vip/releases/download/latest/install.sh) githubReadme +``` + +启动 cursor-vip: +```bash +cursor-vip +``` +首次启动后需安装信任证书,证书会在首次启动命令后自动生成,路径为 `~/.cursor-vip/cursor-vip-ca-cert.pem`。 +* MacOS: 在终端执行 `open ~/.cursor-vip`,双击 cursor-vip-ca-cert.pem 文件,弹出“钥匙串访问”窗口,选择证书,搜索 cursor-vip,双击 cursor-vip,展开信任,选择使用此证书时“始终信任”,关闭弹窗,输入密码确认,证书安装完成。 +* Windows: 在windows搜索输入 cer,选择`管理用户证书`功能,展开`受信任的根证书颁发机构`,选中`证书`,右键`所有任务`,选择`导入`,下一步,输入`%homepath%\.cursor-vip\cursor-vip-ca-cert.pem`文件,一直下一步,完成; 重新打开浏览器。 +* Linux: //TODO + +享受 cursor-vip: +* 打开 CURSOR 智能代码编辑器,点击右上角设置图标,退出然后登录即可 + + diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..72814e9 --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# garble混淆安装: go install mvdan.cc/garble@latest +GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 garble -literals -tiny build -ldflags "-w -s" -o build/cursor-vip_darwin_amd64; +GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 garble -literals -tiny build -ldflags "-w -s" -o build/cursor-vip_darwin_arm64; +# rsrc 应用程序图标安装: go install github.com/akavel/rsrc@latest +rsrc -arch amd64 -ico rsrc.ico -o rsrc.syso; +GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o build/cursor-vip_windows_amd64.exe; +rm rsrc.syso; +rsrc -arch arm -ico rsrc.ico -o rsrc.syso; +GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-w -s" -o build/cursor-vip_windows_arm64.exe; +rm rsrc.syso; + +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 garble -literals -tiny build -ldflags "-w -s" -o build/cursor-vip_linux_amd64; +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 garble -literals -tiny build -ldflags "-w -s" -o build/cursor-vip_linux_arm64; + +chmod +x build/install.sh; +chmod +x build/cursor-vip_darwin_amd64; +chmod +x build/cursor-vip_darwin_arm64; +chmod +x build/cursor-vip_windows_amd64.exe; +chmod +x build/cursor-vip_windows_arm64.exe; +chmod +x build/cursor-vip_linux_amd64; +chmod +x build/cursor-vip_linux_arm64; diff --git a/build/install.sh b/build/install.sh new file mode 100755 index 0000000..957a1e9 --- /dev/null +++ b/build/install.sh @@ -0,0 +1,95 @@ +set -e +URLS=("https://mirror.ghproxy.com/https://github.com/kingparks/cursor-vip/releases/download/latest/") +url=${URLS[0]} +lc_type=$(echo $LC_CTYPE | cut -c 1-2) +if [ -z $lc_type ]; then + lc_type=$(echo $LANG | cut -c 1-2) +fi + +if [ "$lc_type" = "zh" ]; then + echo "正在安装..." +else + echo "Installing..." +fi + +for url0 in ${URLS[@]}; do + if curl -Is --connect-timeout 4 "$url0" | grep -q "HTTP/1.1 404"; then + url=$url0 + break + fi +done + +os_name=$(uname -s | tr '[:upper:]' '[:lower:]') +if [[ $os_name == *"mingw"* ]]; then + os_name="windows" +fi +raw_hw_name=$(uname -m) +case "$raw_hw_name" in +"amd64") + hw_name="amd64" + ;; +"x86_64") + hw_name="amd64" + ;; +"arm64") + hw_name="arm64" + ;; +"aarch64") + hw_name="arm64" + ;; +"i686") + hw_name="386" + ;; +"armv7l") + hw_name="arm" + ;; +*) + echo "Unsupported hardware: $raw_hw_name" + exit 1 + ;; +esac + +if [ "$lc_type" = "zh" ]; then + echo "当前系统为 ${os_name} ${hw_name}" +else + echo "Current system is ${os_name} ${hw_name}" +fi + +if [ ! -z $1 ]; then + echo $1 >~/.cursor-viprc +fi + +# 如果是mac或者linux系统 +if [[ $os_name == "darwin" || $os_name == "linux" ]]; then + if [ "$lc_type" = "zh" ]; then + echo "请输入开机密码" + else + echo "Please enter the boot password" + fi; + sudo mkdir -p /usr/local/bin + sudo curl -Lo /usr/local/bin/cursor-vip ${url}/cursor-vip_${os_name}_${hw_name} + sudo chmod +x /usr/local/bin/cursor-vip + if [ "$lc_type" = "zh" ]; then + echo "安装完成!自动运行;下次可直接输入 cursor-vip 并回车来运行程序" + else + echo "Installation completed! Automatically run; you can run the program by entering cursor-vip and pressing Enter next time" + fi; + + echo "" + cursor-vip +fi; +# 如果是windows系统 +if [[ $os_name == "windows" ]]; then + curl -Lo ${USERPROFILE}/Desktop/cursor-vip.exe ${url}/cursor-vip_${os_name}_${hw_name}.exe + if [ "$lc_type" = "zh" ]; then + echo "安装完成!自动运行; 下次可直接输入 ./cursor-vip.exe 并回车来运行程序" + echo "运行后如果360等杀毒软件误报木马,添加信任后,重新输入./cursor-vip.exe 并回车来运行程序" + else + echo "Installation completed! Automatically run; you can run the program by entering ./cursor-vip.exe and pressing Enter next time" + echo "After running, if 360 antivirus software reports a Trojan horse, add trust, and then re-enter ./cursor-vip.exe and press Enter to run the program" + fi + + echo "" + chmod +x ${USERPROFILE}/Desktop/cursor-vip.exe + ${USERPROFILE}/Desktop/cursor-vip.exe +fi diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..462904d --- /dev/null +++ b/go.mod @@ -0,0 +1,66 @@ +module github.com/kingparks/cursor-vip + +go 1.22.0 + +require ( + github.com/astaxie/beego v1.12.3 + github.com/atotto/clipboard v0.1.4 + github.com/edluis37/shortuuid/v4 v4.0.0-20221015205646-3117f62f0327 + github.com/gin-gonic/gin v1.10.0 + github.com/go-pay/gopay v1.5.103 + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da + github.com/kingparks/goutil v1.0.0 + github.com/lqqyt2423/go-mitmproxy v1.8.5 + github.com/robfig/cron/v3 v3.0.1 + github.com/sirupsen/logrus v1.8.1 + github.com/tidwall/gjson v1.17.1 + github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361 + golang.org/x/sys v0.22.0 + gorm.io/driver/mysql v1.5.7 + gorm.io/gorm v1.25.11 + howett.net/plist v1.0.1 +) + +require ( + github.com/andybalholm/brotli v1.0.4 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-pay/crypto v0.0.1 // indirect + github.com/go-pay/util v0.0.2 // indirect + github.com/go-pay/xlog v0.0.3 // indirect + github.com/go-pay/xtime v0.0.2 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/satori/go.uuid v1.2.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + go.uber.org/atomic v1.11.0 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.25.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/ini.v1 v1.46.0 // indirect + gopkg.in/yaml.v2 v2.2.8 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..993170e --- /dev/null +++ b/go.sum @@ -0,0 +1,311 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= +github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ= +github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA= +github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= +github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= +github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= +github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= +github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= +github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/edluis37/shortuuid/v4 v4.0.0-20221015205646-3117f62f0327 h1:08sR1+VPyRZPokp28Eozlp81XF62bXIMzOLCaq9TBq8= +github.com/edluis37/shortuuid/v4 v4.0.0-20221015205646-3117f62f0327/go.mod h1:uiUXsMjoybdP5L1LUZQXMb2qUr6lJxGcAYzfSHrVei8= +github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI= +github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-pay/crypto v0.0.1 h1:B6InT8CLfSLc6nGRVx9VMJRBBazFMjr293+jl0lLXUY= +github.com/go-pay/crypto v0.0.1/go.mod h1:41oEIvHMKbNcYlWUlRWtsnC6+ASgh7u29z0gJXe5bes= +github.com/go-pay/gopay v1.5.103 h1:tjteCpcApf0CpiwKywMl6UnbLkMeYLJVEuVBtsQbyb8= +github.com/go-pay/gopay v1.5.103/go.mod h1:4+jKRvgmB8clKN1/E9M60miXKbnZ8wWGcg/Hsxn7k44= +github.com/go-pay/util v0.0.2 h1:goJ4f6kNY5zzdtg1Cj8oWC+Cw7bfg/qq2rJangMAb9U= +github.com/go-pay/util v0.0.2/go.mod h1:qM8VbyF1n7YAPZBSJONSPMPsPedhUTktewUAdf1AjPg= +github.com/go-pay/xlog v0.0.3 h1:avyMhCL/JgBHreoGx/am/kHxfs1udDOAeVqbmzP/Yes= +github.com/go-pay/xlog v0.0.3/go.mod h1:mH47xbobrdsSHWsmFtSF5agWbMHFP+tK0ZbVCk5OAEw= +github.com/go-pay/xtime v0.0.2 h1:7YR4/iuELsEHpJ6LUO0SVK80hQxDO9MLCfuVYIiTCRM= +github.com/go-pay/xtime v0.0.2/go.mod h1:W1yRbJaSt4CSBcdAtLBQ8xajiN/Pl5hquGczUcUE9xE= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg= +github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kingparks/goutil v1.0.0 h1:RY9ReXfzRSK8ke1hMKRtX3M/x2J98RrRe/rSIrV3dmE= +github.com/kingparks/goutil v1.0.0/go.mod h1:VeBwPRHwORDtyZrcGPVye1oAjpBuzzjgk2W5RZuW/8Q= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lqqyt2423/go-mitmproxy v1.8.5 h1:F/Jt+Z5+LkJVMvjbRNtovCt6EuPArnumSOcRK9ImU7Q= +github.com/lqqyt2423/go-mitmproxy v1.8.5/go.mod h1:dSGnI17tVZ8dtYu9vnaIz7kxVwJNFH0CoNQwEQlTpxE= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= +github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= +github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= +github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= +github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY= +github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= +github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= +github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= +github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= +github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361 h1:4Ij5sX4JEzCCY/CCl8trJHey1tPsIDomYTZf145GKk0= +github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361/go.mod h1:+5rDk6sDGpl3azws3O+f+GpFSyN9GVr0K8cvQLQM2ZQ= +github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= +github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.46.0 h1:VeDZbLYGaupuvIrsYCEOe/L/2Pcs5n7hdO1ZTjporag= +gopkg.in/ini.v1 v1.46.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= +gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg= +gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= +howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM= +howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/main.go b/main.go new file mode 100644 index 0000000..caf059d --- /dev/null +++ b/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "github.com/kingparks/cursor-vip/auth" + "github.com/kingparks/cursor-vip/tui" + "os" + "os/signal" + "syscall" +) + +func main() { + productIndexSelected := tui.Run() + startServer(productIndexSelected) +} + +func startServer(productIndexSelected string) { + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + go func() { + <-sigs + tui.UnSetProxy() + os.Exit(0) + }() + tui.SetProxy("localhost", auth.Port) + auth.Run(productIndexSelected) +} diff --git a/rsrc.ico b/rsrc.ico new file mode 100644 index 0000000000000000000000000000000000000000..7a6ba2e15f0574adc415b5d70caae292194a960d GIT binary patch literal 15406 zcmeI(K@Ng25QX7q^ZP 0 { + fmt.Printf(yellow, proxyText) + } +} + +func (c *Client) setHost() { + for _, v := range c.Hosts { + _, err := httplib.Get(v).SetTimeout(4*time.Second, 4*time.Second).String() + if err == nil { + c.host = v + return + } + } + return +} + +func (c *Client) GetAD() (ad string) { + res, err := httplib.Get(c.host + "/ad").String() + if err != nil { + return + } + return res +} + +func (c *Client) GetPayUrl() (payUrl, orderID string) { + res, err := httplib.Get(c.host + "/payUrl").String() + if err != nil { + fmt.Println(err) + return + } + payUrl = gjson.Get(res, "payUrl").String() + orderID = gjson.Get(res, "orderID").String() + return +} +func (c *Client) PayCheck(orderID, deviceID string) (isPay bool) { + res, err := httplib.Get(c.host + "/payCheck?orderID=" + orderID + "&deviceID=" + deviceID).String() + if err != nil { + fmt.Println(err) + return + } + isPay = gjson.Get(res, "isPay").Bool() + return +} + +func (c *Client) GetMyInfo(deviceID string) (sCount, sPayCount, isPay, ticket, exp string) { + body, _ := json.Marshal(map[string]string{ + "device": deviceID, + "sDevice": getPromotion(), + }) + res, err := httplib.Post(host + "/my").Body(body).String() + if err != nil { + return + } + sCount = gjson.Get(res, "sCount").String() + sPayCount = gjson.Get(res, "sPayCount").String() + isPay = gjson.Get(res, "isPay").String() + ticket = gjson.Get(res, "ticket").String() + exp = gjson.Get(res, "exp").String() + return +} + +func (c *Client) CheckVersion(version string) (upUrl string) { + res, err := httplib.Get(host + "/version?version=" + version + "&plat=" + runtime.GOOS + "_" + runtime.GOARCH).String() + if err != nil { + return "" + } + upUrl = gjson.Get(res, "url").String() + return +} + +func (c *Client) GetLic() (isOk bool, result string) { + req := httplib.Get(host + "/getLic?device=" + getMacMD5()) + res, err := req.String() + if err != nil { + isOk = false + result = err.Error() + return + } + code := gjson.Get(res, "code").Int() + msg := gjson.Get(res, "msg").String() + result = msg + if code != 0 { + isOk = false + return + } + isOk = true + return +} diff --git a/tui/locales/en.ini b/tui/locales/en.ini new file mode 100644 index 0000000..f5ef0b6 --- /dev/null +++ b/tui/locales/en.ini @@ -0,0 +1,25 @@ +CURSOR VIP:CURSOR VIP +设备码:DeviceID +付费到期时间:Paid expiration time +推广命令:(已推广:Promotion command:(promoted +人,推广已付费: paid +人;每推广10人或推广付费2人可获得一年授权): every 10 people promoted or 2 people paid can get a one-year license) +选择要授权的产品::Choose the product to authorize: +请输入产品编号(直接回车默认为1,可以同时输入多个例如 145)::Please enter the product number (press Enter directly to default to 1, you can enter multiple at the same time, such as 145): +输入有误:Input error +选择的产品为::The selected product is: +选择有效期::Select validity period: +请输入有效期编号(直接回车默认为1)::Please enter the validity period number (press Enter directly to default to 1): +选择的有效期为::The selected validity period is: +(已复制到剪贴板):(Copied to clipboard) +使用浏览器打开下面地址进行捐赠:Open the following address in the browser to donate +捐赠完成后请回车:Please press Enter after donation +未捐赠,请捐赠完成后回车:Not donated, please press Enter after donation +首次执行请重启IDE,然后填入下面授权码;非首次执行直接填入下面授权码即可:For the first execution, please restart the IDE, then fill in the authorization code below; for non-first execution, fill in the authorization code below directly +有新版本可用,尝试自动更新中,若失败,请输入下面命令并回车手动更新程序::There is a new version available, trying to update automatically. If it fails, please enter the following command and press Enter to update the program manually: +更新完成,重新运行程序即可:Update completed, rerun the program to take effect +经由:Via +代理访问:Proxy access +授权成功!使用过程请不要关闭此窗口:Authorization successful! Please do not close this window during use +请先按教程信任证书: Please trust the certificate according to the tutorial first + diff --git a/tui/locales/es.ini b/tui/locales/es.ini new file mode 100644 index 0000000..90a1155 --- /dev/null +++ b/tui/locales/es.ini @@ -0,0 +1,24 @@ +CURSOR VIP:CURSOR VIP +设备码:Código de dispositivo +付费到期时间:Tiempo de vencimiento pagado +推广命令:(已推广:Comando de promoción:(promocionado +人,推广已付费: pagado +人;每推广10人或推广付费2人可获得一年授权): cada 10 personas promocionadas o 2 personas pagadas pueden obtener una licencia de un año) +选择要授权的产品::Elija el producto para autorizar: +请输入产品编号(直接回车默认为1,可以同时输入多个例如 145)::Ingrese el número de producto (presione Enter directamente para que sea 1, puede ingresar varios al mismo tiempo, como 145): +输入有误:Error de entrada +选择的产品为::El producto seleccionado es: +选择有效期::Seleccione el período de validez: +请输入有效期编号(直接回车默认为1)::Ingrese el número de período de validez (presione Enter directamente para que sea 1): +选择的有效期为::El período de validez seleccionado es: +(已复制到剪贴板):(Copiado al portapapeles) +使用浏览器打开下面地址进行捐赠:Abra la siguiente dirección en el navegador para donar +捐赠完成后请回车:Presione Enter después de la donación +未捐赠,请捐赠完成后回车:No donado, presione Enter después de la donación +首次执行请重启IDE,然后填入下面授权码;非首次执行直接填入下面授权码即可:Para la primera ejecución, reinicie el IDE, luego complete el código de autorización a continuación; para la ejecución no inicial, complete el código de autorización a continuación directamente +有新版本可用,尝试自动更新中,若失败,请输入下面命令并回车手动更新程序::Hay una nueva versión disponible, intentando actualizar automáticamente. Si falla, ingrese el siguiente comando y presione Enter para actualizar el programa manualmente: +更新完成,重新运行程序即可:Actualización completada, vuelva a ejecutar el programa para que surta efecto +经由:Por +代理访问:Acceso a través de proxy +授权成功!使用过程请不要关闭此窗口:¡Autorización exitosa! Por favor, no cierre esta ventana durante el uso +请先按教程信任证书: Por favor, confíe en el certificado según el tutorial primero diff --git a/tui/locales/hu.ini b/tui/locales/hu.ini new file mode 100644 index 0000000..449a932 --- /dev/null +++ b/tui/locales/hu.ini @@ -0,0 +1,24 @@ +CURSOR VIP:CURSOR VIP +设备码:Készülék kód +付费到期时间:Lejárat dátuma +推广命令:(已推广: promóció parancs: (már promóció: +人,推广已付费: megfizetett +人;每推广10人或推广付费2人可获得一年授权): személy; minden 10 promóció vagy 2 fizetett promóció esetén egy éves engedélyt kaphat) +选择要授权的产品::Válassza ki a terméket, amelyet engedélyezni szeretne: +请输入产品编号(直接回车默认为1,可以同时输入多个例如 145)::Kérjük, adja meg a cikkszámot (közvetlenül adja meg az alapértelmezett értékeket 1-re, egyszerre többet is megadhat, például 145): +输入有误:Rossz bemenet +选择的产品为::A kiválasztott termék: +选择有效期::Válassza ki a lejárati időt: +请输入有效期编号(直接回车默认为1)::Kérjük, adja meg az érvényességi számot (közvetlenül írja be az alapértelmezett értékeket 1-re): +选择的有效期为::A kiválasztott lejárati idő: +(已复制到剪贴板):(Másolva a vágólapra) +使用浏览器打开下面地址进行捐赠:Használja a böngészőt az alábbi cím megnyitásához a felajánláshoz: +捐赠完成后请回车:Kérjük, nyomja meg az Enter billentyűt a felajánlás befejezése után +未捐赠,请捐赠完成后回车:Ön nem adományozott, kérjük, nyomja meg az Enter billentyűt a felajánlás befejezése után +首次执行请重启IDE,然后填入下面授权码;非首次执行直接填入下面授权码即可:Az IDE újraindítása után először hajtsa végre, majd adja meg az alábbi engedélykódot; ha nem az első végrehajtás, adja meg az alábbi engedélykódot +有新版本可用,尝试自动更新中,若失败,请输入下面命令并回车手动更新程序::Új verzió érhető el, automatikus frissítés kísérlet alatt, ha nem sikerül, adja meg az alábbi parancsot, majd nyomja meg az Enter billentyűt a program manuális frissítéséhez: +更新完成,重新运行程序即可:Frissítés befejezve, indítsa újra a programot +经由:Által +代理访问:proxy hozzáférés +授权成功!使用过程请不要关闭此窗口:Engedélyezés sikeres! Kérjük, ne zárja be ezt az ablakot a használat során +请先按教程信任证书: Kérjük, először bízzon meg a tanúsítványban az útmutató szerint diff --git a/tui/locales/nl.ini b/tui/locales/nl.ini new file mode 100644 index 0000000..5ccf929 --- /dev/null +++ b/tui/locales/nl.ini @@ -0,0 +1,24 @@ +CURSOR VIP:CURSOR VIP +设备码:Apparaat-ID +付费到期时间:Betaalde vervaldatum +推广命令:(已推广:Promotiecommando:(gepromoot +人,推广已付费: betaald +人;每推广10人或推广付费2人可获得一年授权): elke 10 mensen gepromoot of 2 mensen betaald kunnen een licentie van een jaar krijgen) +选择要授权的产品::Kies het product om te autoriseren: +请输入产品编号(直接回车默认为1,可以同时输入多个例如 145)::Voer het productnummer in (druk op Enter om standaard naar 1 te gaan, u kunt meerdere tegelijk invoeren, zoals 145): +输入有误:Invoerfout +选择的产品为::Het geselecteerde product is: +选择有效期::Selecteer de geldigheidsduur: +请输入有效期编号(直接回车默认为1)::Voer het nummer van de geldigheidsduur in (druk op Enter om standaard naar 1 te gaan): +选择的有效期为::De geselecteerde geldigheidsduur is: +(已复制到剪贴板):(Gekopieerd naar klembord) +使用浏览器打开下面地址进行捐赠:Open het volgende adres in de browser om te doneren +捐赠完成后请回车:Druk na donatie op Enter +未捐赠,请捐赠完成后回车:Niet gedoneerd, druk op Enter na donatie +首次执行请重启IDE,然后填入下面授权码;非首次执行直接填入下面授权码即可:Herstart de IDE voor de eerste uitvoering en vul vervolgens de onderstaande autorisatiecode in; voor niet-eerste uitvoering, vul de onderstaande autorisatiecode direct in +有新版本可用,尝试自动更新中,若失败,请输入下面命令并回车手动更新程序::Er is een nieuwe versie beschikbaar, probeer automatisch bij te werken. Als dit mislukt, voer dan de volgende opdracht in en druk op Enter om het programma handmatig bij te werken: +更新完成,重新运行程序即可:Update voltooid, start het programma opnieuw om van kracht te worden +经由:Via +代理访问:Proxy-toegang +授权成功!使用过程请不要关闭此窗口:Authorisatie succesvol! Sluit dit venster niet tijdens gebruik +请先按教程信任证书: Vertrouw eerst op het certificaat volgens de tutorial diff --git a/tui/locales/ru.ini b/tui/locales/ru.ini new file mode 100644 index 0000000..f4499d4 --- /dev/null +++ b/tui/locales/ru.ini @@ -0,0 +1,24 @@ +CURSOR VIP:CURSOR VIP +设备码:Идентификатор устройства +付费到期时间:Оплаченное время истекло +推广命令:(已推广:Команда продвижения:(продвинутый +人,推广已付费: оплаченный +人;每推广10人或推广付费2人可获得一年授权): каждые 10 продвинутых или 2 оплаченных человека могут получить лицензию на год) +选择要授权的产品::Выберите продукт для авторизации: +请输入产品编号(直接回车默认为1,可以同时输入多个例如 145)::Введите номер продукта (нажмите Enter, чтобы выбрать 1, вы можете ввести несколько одновременно, например 145): +输入有误:Ошибка ввода +选择的产品为::Выбранный продукт: +选择有效期::Выберите срок действия: +请输入有效期编号(直接回车默认为1)::Введите номер срока действия (нажмите Enter, чтобы выбрать 1): +选择的有效期为::Выбранный срок действия: +(已复制到剪贴板):(Скопировано в буфер обмена) +使用浏览器打开下面地址进行捐赠:Откройте следующий адрес в браузере, чтобы сделать пожертвование +捐赠完成后请回车:Пожалуйста, нажмите Enter после пожертвования +未捐赠,请捐赠完成后回车:Не пожертвовано, пожалуйста, нажмите Enter после пожертвования +首次执行请重启IDE,然后填入下面授权码;非首次执行直接填入下面授权码即可:Для первого выполнения перезапустите IDE, затем введите код авторизации ниже; для последующих выполнений введите код авторизации ниже непосредственно +有新版本可用,尝试自动更新中,若失败,请输入下面命令并回车手动更新程序::Доступна новая версия, попытка автоматического обновления. Если не удастся, введите следующую команду и нажмите Enter, чтобы обновить программу вручную: +更新完成,重新运行程序即可:Обновление завершено, перезапустите программу для вступления в силу +经由:Через +代理访问:Доступ через прокси +授权成功!使用过程请不要关闭此窗口:Авторизация успешна! Пожалуйста, не закрывайте это окно во время использования +请先按教程信任证书: Пожалуйста, сначала доверьтесь сертификату согласно руководству diff --git a/tui/locales/tr.ini b/tui/locales/tr.ini new file mode 100644 index 0000000..9caca74 --- /dev/null +++ b/tui/locales/tr.ini @@ -0,0 +1,24 @@ +CURSOR VIP:VIP İmleci +设备码:Cihaz Kimliği +付费到期时间:Ödeme süresi doldu +推广命令:(已推广:Promosyon komutu:(gelişmiş +人,推广已付费: ödenmiş +人;每推广10人或推广付费2人可获得一年授权): her 10 gelişmiş veya 2 ödenmiş kişi yıllık lisans alabilir) +选择要授权的产品::Lisanslamak için bir ürün seçin: +请输入产品编号(直接回车默认为1,可以同时输入多个例如 145)::Ürün numarasını girin (1'i seçmek için Enter'a basın, aynı anda birden fazla girebilirsiniz, örneğin 145): +输入有误:Hatalı giriş +选择的产品为::Seçilen ürün: +选择有效期::Geçerlilik süresini seçin: +请输入有效期编号(直接回车默认为1)::Geçerlilik süresi numarasını girin (1'i seçmek için Enter'a basın): +选择的有效期为::Seçilen geçerlilik süresi: +(已复制到剪贴板):(Panoya kopyalandı) +使用浏览器打开下面地址进行捐赠:Bağış yapmak için aşağıdaki adresi tarayıcıda açın +捐赠完成后请回车:Bağış yapın ve ardından Enter tuşuna basın +未捐赠,请捐赠完成后回车:Bağış yapmadınız, bağış yaptıktan sonra Enter tuşuna basın +首次执行请重启IDE,然后填入下面授权码;非首次执行直接填入下面授权码即可:IDE'yi ilk kez çalıştırın, ardından aşağıdaki kimlik doğrulama kodunu girin; daha sonraki çalışmalarda kimlik doğrulama kodunu doğrudan girin +有新版本可用,尝试自动更新中,若失败,请输入下面命令并回车手动更新程序::Yeni bir sürüm mevcut, otomatik güncelleme denemesi yapılıyor. Başarısız olursa, aşağıdaki komutu girin ve Enter tuşuna basarak programı manuel olarak güncelleyin: +更新完成,重新运行程序即可:Güncelleme tamamlandı, yürürlüğe girmek için programı yeniden başlatın +经由:Aracılığıyla +代理访问:Proxy erişimi +授权成功!使用过程请不要关闭此窗口:Kimlik doğrulama başarılı! Kullanım sırasında bu pencereyi kapatmayın +请先按教程信任证书: Lütfen önce belirtilen talimatlara göre sertifikaya güvenin diff --git a/tui/setProxy_linux.go b/tui/setProxy_linux.go new file mode 100644 index 0000000..3ae9738 --- /dev/null +++ b/tui/setProxy_linux.go @@ -0,0 +1,12 @@ +//go:build linux +// +build linux + +package tui + +func SetProxy(server string, port string) { + // TODO Set HTTP proxy +} + +func UnSetProxy() { + // TODO Unset HTTP proxy +} diff --git a/tui/setProxy_mac.go b/tui/setProxy_mac.go new file mode 100644 index 0000000..25a4318 --- /dev/null +++ b/tui/setProxy_mac.go @@ -0,0 +1,41 @@ +//go:build darwin +// +build darwin + +package tui + +import ( + "log" + "os/exec" +) + +func SetProxy(server string, port string) { + // Set HTTP proxy + cmd := exec.Command("networksetup", "-setwebproxy", "Wi-Fi", server, port) + err := cmd.Run() + if err != nil { + log.Fatalf("Failed to set HTTP proxy: %v", err) + } + + // Set HTTPS proxy + cmd = exec.Command("networksetup", "-setsecurewebproxy", "Wi-Fi", server, port) + err = cmd.Run() + if err != nil { + log.Fatalf("Failed to set HTTPS proxy: %v", err) + } +} + +func UnSetProxy() { + // Unset HTTP proxy + cmd := exec.Command("networksetup", "-setwebproxystate", "Wi-Fi", "off") + err := cmd.Run() + if err != nil { + log.Fatalf("Failed to unset HTTP proxy: %v", err) + } + + // Unset HTTPS proxy + cmd = exec.Command("networksetup", "-setsecurewebproxystate", "Wi-Fi", "off") + err = cmd.Run() + if err != nil { + log.Fatalf("Failed to unset HTTPS proxy: %v", err) + } +} diff --git a/tui/setProxy_win.go b/tui/setProxy_win.go new file mode 100644 index 0000000..2da46bd --- /dev/null +++ b/tui/setProxy_win.go @@ -0,0 +1,40 @@ +//go:build windows +// +build windows + +package tui + +import ( + "golang.org/x/sys/windows/registry" + "log" +) + +func SetProxy(server string, port string) { + k, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Internet Settings`, registry.ALL_ACCESS) + if err != nil { + log.Fatal(err) + } + defer k.Close() + + err = k.SetStringValue("ProxyServer", server+":"+port) + if err != nil { + log.Fatal(err) + } + + err = k.SetDWordValue("ProxyEnable", 1) + if err != nil { + log.Fatal(err) + } +} + +func UnSetProxy() { + k, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Internet Settings`, registry.ALL_ACCESS) + if err != nil { + log.Fatal(err) + } + defer k.Close() + + err = k.SetDWordValue("ProxyEnable", 0) + if err != nil { + log.Fatal(err) + } +} diff --git a/tui/tui.go b/tui/tui.go new file mode 100644 index 0000000..f64c034 --- /dev/null +++ b/tui/tui.go @@ -0,0 +1,298 @@ +package tui + +import ( + "crypto/md5" + "embed" + "flag" + "fmt" + "github.com/atotto/clipboard" + "howett.net/plist" + "log" + "net" + "os" + "os/exec" + "runtime" + "sort" + "strconv" + "strings" + "time" + + "github.com/unknwon/i18n" +) + +var version = 100 + +var hosts = []string{"http://129.154.205.7:7193"} +var host = hosts[0] +var githubPath = "https://mirror.ghproxy.com/https://github.com/kingparks/cursor-vip/releases/download/latest/" +var err error + +var green = "\033[32m%s\033[0m\n" +var yellow = "\033[33m%s\033[0m\n" +var hGreen = "\033[1;32m%s\033[0m" +var dGreen = "\033[4;32m%s\033[0m\n" +var red = "\033[31m%s\033[0m\n" +var defaultColor = "%s" +var lang, _ = getLocale() +var deviceID = getMacMD5() +var Cli = Client{Hosts: hosts} + +//go:embed all:locales +var localeFS embed.FS + +type Tr struct { + i18n.Locale +} + +var Trr *Tr + +var jbProduct = []string{"cursor IDE"} + +func Run() (productIndexSelected string) { + language := flag.String("l", lang, "set language, eg: zh, en, nl, ru, hu, Trr") + flag.Parse() + + localeFileEn, _ := localeFS.ReadFile("locales/en.ini") + _ = i18n.SetMessage("en", localeFileEn) + localeFileNl, _ := localeFS.ReadFile("locales/nl.ini") + _ = i18n.SetMessage("nl", localeFileNl) + localeFileRu, _ := localeFS.ReadFile("locales/ru.ini") + _ = i18n.SetMessage("ru", localeFileRu) + localeFileHu, _ := localeFS.ReadFile("locales/hu.ini") + _ = i18n.SetMessage("hu", localeFileHu) + localeFileTr, _ := localeFS.ReadFile("locales/Trr.ini") + _ = i18n.SetMessage("Trr", localeFileTr) + localeFileEs, _ := localeFS.ReadFile("locales/es.ini") + _ = i18n.SetMessage("es", localeFileEs) + lang = *language + switch lang { + case "zh": + Trr = &Tr{Locale: i18n.Locale{Lang: "zh"}} + case "nl": + Trr = &Tr{Locale: i18n.Locale{Lang: "nl"}} + case "ru": + Trr = &Tr{Locale: i18n.Locale{Lang: "ru"}} + case "hu": + Trr = &Tr{Locale: i18n.Locale{Lang: "hu"}} + case "Trr": + Trr = &Tr{Locale: i18n.Locale{Lang: "Trr"}} + case "es": + Trr = &Tr{Locale: i18n.Locale{Lang: "es"}} + default: + Trr = &Tr{Locale: i18n.Locale{Lang: "en"}} + } + + fmt.Printf(green, Trr.Tr("CURSOR VIP")+` v`+strings.Join(strings.Split(fmt.Sprint(version), ""), ".")) + Cli.SetProxy(lang) + sCount, sPayCount, _, _, exp := Cli.GetMyInfo(deviceID) + fmt.Printf(green, Trr.Tr("设备码")+":"+deviceID) + expTime, _ := time.ParseInLocation("2006-01-02 15:04:05", exp, time.Local) + fmt.Printf(green, Trr.Tr("付费到期时间")+":"+exp) + fmt.Printf("\033[32m%s\033[0m\u001B[1;32m %s \u001B[0m\033[32m%s\033[0m\u001B[1;32m %s \u001B[0m\u001B[32m%s\u001B[0m\n", + Trr.Tr("推广命令:(已推广"), sCount, Trr.Tr("人,推广已付费"), sPayCount, Trr.Tr("人;每推广10人或推广付费2人可获得一年授权)")) + fmt.Printf(hGreen, "bash <(curl "+githubPath+"install.sh) "+deviceID+"\n") + + printAD() + checkUpdate(version) + fmt.Println() + if len(jbProduct) > 1 { + fmt.Printf(defaultColor, Trr.Tr("选择要授权的产品:")) + for i, v := range jbProduct { + fmt.Printf(hGreen, fmt.Sprintf("%d. %s\t", i+1, v)) + } + fmt.Println() + fmt.Print(Trr.Tr("请输入产品编号(直接回车默认为1,可以同时输入多个例如 145):")) + productIndex := 1 + _, _ = fmt.Scanln(&productIndex) + if productIndex < 1 { + fmt.Println(Trr.Tr("输入有误")) + return + } + for _, v := range strings.Split(fmt.Sprint(productIndex), "") { + vi, _ := strconv.Atoi(v) + productIndexSelected += jbProduct[vi-1] + "," + } + if len(productIndexSelected) > 1 { + productIndexSelected = productIndexSelected[:len(productIndexSelected)-1] + } + fmt.Println(Trr.Tr("选择的产品为:") + productIndexSelected) + fmt.Println() + } else { + productIndexSelected = jbProduct[0] + } + // 到期了 + if expTime.Before(time.Now()) { + payUrl, orderID := Cli.GetPayUrl() + isCopyText := "" + errClip := clipboard.WriteAll(payUrl) + if errClip == nil { + isCopyText = Trr.Tr("(已复制到剪贴板)") + } + fmt.Println(Trr.Tr("使用浏览器打开下面地址进行捐赠") + isCopyText) + fmt.Printf(dGreen, payUrl) + fmt.Println(Trr.Tr("捐赠完成后请回车")) + //检测控制台回车 + checkPay: + _, _ = fmt.Scanln() + isPay := Cli.PayCheck(orderID, deviceID) + if !isPay { + fmt.Println(Trr.Tr("未捐赠,请捐赠完成后回车")) + goto checkPay + } + isOk, result := Cli.GetLic() + if !isOk { + fmt.Printf(red, result) + return + } + fmt.Println() + } + fmt.Printf(green, Trr.Tr("授权成功!使用过程请不要关闭此窗口")) + return +} + +func getMacMD5() string { + // 获取本机的MAC地址 + interfaces, err := net.Interfaces() + if err != nil { + fmt.Println("err:", err) + return "" + } + var macAddress []string + for _, inter := range interfaces { + // 大于en6的排除 + if strings.HasPrefix(inter.Name, "en") { + numStr := inter.Name[2:] + num, _ := strconv.Atoi(numStr) + if num > 6 { + continue + } + } + if strings.HasPrefix(inter.Name, "en") || strings.HasPrefix(inter.Name, "Ethernet") || strings.HasPrefix(inter.Name, "以太网") || strings.HasPrefix(inter.Name, "WLAN") { + macAddress = append(macAddress, inter.HardwareAddr.String()) + } + } + sort.Strings(macAddress) + return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(macAddress, ",")))) +} + +func printAD() { + ad := Cli.GetAD() + if len(ad) == 0 { + return + } + fmt.Printf(yellow, ad) +} + +func checkUpdate(version int) { + upUrl := Cli.CheckVersion(fmt.Sprint(version)) + if upUrl != "" { + fmt.Printf(red, Trr.Tr("有新版本可用,尝试自动更新中,若失败,请输入下面命令并回车手动更新程序:")) + fmt.Println() + fmt.Println(`bash -c "$(curl -fsSL ` + githubPath + `install.sh)"`) + var cmd *exec.Cmd + if strings.Contains(strings.ToLower(os.Getenv("ComSpec")), "cmd.exe") { + cmd = exec.Command("C:\\Program Files\\Git\\git-bash.exe", "-c", fmt.Sprintf(`bash -c "$(curl -fsSL %sinstall.sh)"`, githubPath)) + } else { + cmd = exec.Command("bash", "-c", fmt.Sprintf(`bash -c "$(curl -fsSL %sinstall.sh)"`, githubPath)) + } + err := cmd.Run() + if err != nil { + log.Fatal(err) + } + fmt.Println(Trr.Tr("更新完成,重新运行程序即可")) + os.Exit(0) + return + } +} + +// 获取推广人 +func getPromotion() (promotion string) { + b, _ := os.ReadFile(os.Getenv("HOME") + "/.cursor-viprc") + promotion = strings.TrimSpace(string(b)) + if len(promotion) == 0 { + if len(os.Args) > 1 { + promotion = os.Args[1] + } + } + return +} + +func getLocale() (langRes, locRes string) { + osHost := runtime.GOOS + langRes = "en" + locRes = "US" + switch osHost { + case "windows": + // Exec powershell Get-Culture on Windows. + cmd := exec.Command("powershell", "Get-Culture | select -exp Name") + output, err := cmd.Output() + if err == nil { + langLocRaw := strings.TrimSpace(string(output)) + langLoc := strings.Split(langLocRaw, "-") + langRes = langLoc[0] + langRes = strings.Split(langRes, "-")[0] + locRes = langLoc[1] + return + } + case "darwin": + // Exec shell Get-Culture on MacOS. + cmd := exec.Command("sh", "osascript -e 'user locale of (get system info)'") + output, err := cmd.Output() + if err == nil { + langLocRaw := strings.TrimSpace(string(output)) + langLoc := strings.Split(langLocRaw, "_") + langRes = langLoc[0] + langRes = strings.Split(langRes, "-")[0] + if len(langLoc) == 1 { + return + } + locRes = langLoc[1] + return + } + plistB, err := os.ReadFile(os.Getenv("HOME") + "/Library/Preferences/.GlobalPreferences.plist") + if err != nil { + panic(err) + } + var a map[string]interface{} + _, err = plist.Unmarshal(plistB, &a) + if err != nil { + panic(err) + } + langLocRaw := a["AppleLocale"].(string) + langLoc := strings.Split(langLocRaw, "_") + langRes = langLoc[0] + langRes = strings.Split(langRes, "-")[0] + if len(langLoc) == 1 { + return + } + locRes = langLoc[1] + return + case "linux": + envlang, ok := os.LookupEnv("LANG") + if ok { + langLocRaw := strings.TrimSpace(envlang) + langLocRaw = strings.Split(envlang, ".")[0] + langLoc := strings.Split(langLocRaw, "_") + langRes = langLoc[0] + langRes = strings.Split(langRes, "-")[0] + if len(langLoc) == 1 { + return + } + locRes = langLoc[1] + return + } + } + if langRes == "" { + langLocRaw := os.Getenv("LC_CTYPE") + langLocRaw = strings.Split(langLocRaw, ".")[0] + langLoc := strings.Split(langLocRaw, "_") + langRes = langLoc[0] + langRes = strings.Split(langRes, "-")[0] + if len(langLoc) == 1 { + return + } + locRes = langLoc[1] + return + } + return +}