diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0c53bbb..47bb19a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,7 +24,7 @@ jobs: run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' - TAG="v0.0.1-$(date +'%Y%m%d%H%M%S')" + TAG="v0.0.2-$(date +'%Y%m%d%H%M%S')" git tag $TAG git push origin $TAG env: diff --git a/README.md b/README.md index 15391ef..725f587 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ - [x] 本机邮件常用端口检测 - [x] 常用邮件平台的SMTP、POP3、IMAP协议检测 +- [x] 部分Windows10系统下打勾打叉编码错误显示,已判断是Win时使用Y/N显示而不是勾叉 ## TODO -- [ ] 部分Windows10系统下打勾打叉编码错误显示,需要判断是Win时使用Y/N显示而不是勾叉 - [ ] 常用端口多地区是否阻断检测 ## 使用(Usage) diff --git a/email/emailcheck.go b/email/emailcheck.go index 6007ee1..64f352d 100644 --- a/email/emailcheck.go +++ b/email/emailcheck.go @@ -5,6 +5,7 @@ import ( "crypto/tls" "fmt" "net" + "runtime" "strings" "sync" "time" @@ -20,9 +21,15 @@ type Result struct { func isLocalPortOpen(port string) string { ln, err := net.Listen("tcp", ":"+port) if err != nil { + if runtime.GOOS == "windows" { + return "N" + } return "✘" } ln.Close() + if runtime.GOOS == "windows" { + return "Y" + } return "✔" } @@ -30,17 +37,32 @@ func checkConnection(host string, port string) string { address := net.JoinHostPort(host, port) conn, err := net.DialTimeout("tcp", address, 5*time.Second) if err != nil { + if runtime.GOOS == "windows" { + return "N" + } return "✘" } defer conn.Close() reader := bufio.NewReader(conn) response, err := reader.ReadString('\n') if err != nil { + if runtime.GOOS == "windows" { + return "N" + } return "✘" } - status := "✘" + var status string + if runtime.GOOS == "windows" { + status = "N" + } else { + status = "✘" + } if strings.Split(response, " ")[0] == "220" || strings.Split(response, " ")[0] == "+OK" || strings.Contains(response, "* OK") { - status = "✔" + if runtime.GOOS == "windows" { + status = "Y" + } else { + status = "✔" + } } return status } @@ -49,17 +71,32 @@ func checkConnectionSSL(host string, port string) string { address := net.JoinHostPort(host, port) conn, err := tls.DialWithDialer(&net.Dialer{Timeout: 5 * time.Second}, "tcp", address, &tls.Config{}) if err != nil { + if runtime.GOOS == "windows" { + return "N" + } return "✘" } defer conn.Close() reader := bufio.NewReader(conn) response, err := reader.ReadString('\n') if err != nil { + if runtime.GOOS == "windows" { + return "N" + } return "✘" } - status := "✘" + var status string + if runtime.GOOS == "windows" { + status = "N" + } else { + status = "✘" + } if strings.HasPrefix(response, "220") { - status = "✔" + if runtime.GOOS == "windows" { + status = "Y" + } else { + status = "✔" + } } return status } @@ -200,4 +237,4 @@ func EmailCheck() string { smtpChanMap[name], smtpsChanMap[name], pop3ChanMap[name], pop3sChanMap[name], imapChanMap[name], imapsChanMap[name])) } return strings.Join(results, "\n") -} \ No newline at end of file +} diff --git a/model/model.go b/model/model.go index 3317ead..ee3c286 100644 --- a/model/model.go +++ b/model/model.go @@ -1,6 +1,6 @@ package model -var Version = "v0.0.1" +var Version = "v0.0.2" var LocalServers = []string{"25", "465", "110", "995", "143", "993"} var Platforms = []string{"QQ", "163", "Sohu", "Yandex", "Gmail", "Outlook", "Office365", "Yahoo", "MailCOM", "MailRU", "AOL", "GMX", "Sina"} var SmtpServers = map[string]string{