mirror of
https://github.com/oneclickvirt/portchecker.git
synced 2025-09-26 20:51:20 +08:00
v0.0.2
This commit is contained in:
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@@ -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:
|
||||
|
@@ -8,10 +8,10 @@
|
||||
|
||||
- [x] 本机邮件常用端口检测
|
||||
- [x] 常用邮件平台的SMTP、POP3、IMAP协议检测
|
||||
- [x] 部分Windows10系统下打勾打叉编码错误显示,已判断是Win时使用Y/N显示而不是勾叉
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] 部分Windows10系统下打勾打叉编码错误显示,需要判断是Win时使用Y/N显示而不是勾叉
|
||||
- [ ] 常用端口多地区是否阻断检测
|
||||
|
||||
## 使用(Usage)
|
||||
|
@@ -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")
|
||||
}
|
||||
}
|
||||
|
@@ -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{
|
||||
|
Reference in New Issue
Block a user