mirror of
https://github.com/oneclickvirt/portchecker.git
synced 2025-09-27 13:02:07 +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: |
|
run: |
|
||||||
git config --global user.name 'github-actions'
|
git config --global user.name 'github-actions'
|
||||||
git config --global user.email 'github-actions@github.com'
|
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 tag $TAG
|
||||||
git push origin $TAG
|
git push origin $TAG
|
||||||
env:
|
env:
|
||||||
|
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
- [x] 本机邮件常用端口检测
|
- [x] 本机邮件常用端口检测
|
||||||
- [x] 常用邮件平台的SMTP、POP3、IMAP协议检测
|
- [x] 常用邮件平台的SMTP、POP3、IMAP协议检测
|
||||||
|
- [x] 部分Windows10系统下打勾打叉编码错误显示,已判断是Win时使用Y/N显示而不是勾叉
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [ ] 部分Windows10系统下打勾打叉编码错误显示,需要判断是Win时使用Y/N显示而不是勾叉
|
|
||||||
- [ ] 常用端口多地区是否阻断检测
|
- [ ] 常用端口多地区是否阻断检测
|
||||||
|
|
||||||
## 使用(Usage)
|
## 使用(Usage)
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -20,9 +21,15 @@ type Result struct {
|
|||||||
func isLocalPortOpen(port string) string {
|
func isLocalPortOpen(port string) string {
|
||||||
ln, err := net.Listen("tcp", ":"+port)
|
ln, err := net.Listen("tcp", ":"+port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "N"
|
||||||
|
}
|
||||||
return "✘"
|
return "✘"
|
||||||
}
|
}
|
||||||
ln.Close()
|
ln.Close()
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "Y"
|
||||||
|
}
|
||||||
return "✔"
|
return "✔"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,18 +37,33 @@ func checkConnection(host string, port string) string {
|
|||||||
address := net.JoinHostPort(host, port)
|
address := net.JoinHostPort(host, port)
|
||||||
conn, err := net.DialTimeout("tcp", address, 5*time.Second)
|
conn, err := net.DialTimeout("tcp", address, 5*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "N"
|
||||||
|
}
|
||||||
return "✘"
|
return "✘"
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
response, err := reader.ReadString('\n')
|
response, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "N"
|
||||||
|
}
|
||||||
return "✘"
|
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") {
|
if strings.Split(response, " ")[0] == "220" || strings.Split(response, " ")[0] == "+OK" || strings.Contains(response, "* OK") {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
status = "Y"
|
||||||
|
} else {
|
||||||
status = "✔"
|
status = "✔"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,18 +71,33 @@ func checkConnectionSSL(host string, port string) string {
|
|||||||
address := net.JoinHostPort(host, port)
|
address := net.JoinHostPort(host, port)
|
||||||
conn, err := tls.DialWithDialer(&net.Dialer{Timeout: 5 * time.Second}, "tcp", address, &tls.Config{})
|
conn, err := tls.DialWithDialer(&net.Dialer{Timeout: 5 * time.Second}, "tcp", address, &tls.Config{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "N"
|
||||||
|
}
|
||||||
return "✘"
|
return "✘"
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
response, err := reader.ReadString('\n')
|
response, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "N"
|
||||||
|
}
|
||||||
return "✘"
|
return "✘"
|
||||||
}
|
}
|
||||||
status := "✘"
|
var status string
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
status = "N"
|
||||||
|
} else {
|
||||||
|
status = "✘"
|
||||||
|
}
|
||||||
if strings.HasPrefix(response, "220") {
|
if strings.HasPrefix(response, "220") {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
status = "Y"
|
||||||
|
} else {
|
||||||
status = "✔"
|
status = "✔"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
var Version = "v0.0.1"
|
var Version = "v0.0.2"
|
||||||
var LocalServers = []string{"25", "465", "110", "995", "143", "993"}
|
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 Platforms = []string{"QQ", "163", "Sohu", "Yandex", "Gmail", "Outlook", "Office365", "Yahoo", "MailCOM", "MailRU", "AOL", "GMX", "Sina"}
|
||||||
var SmtpServers = map[string]string{
|
var SmtpServers = map[string]string{
|
||||||
|
Reference in New Issue
Block a user