first commit

This commit is contained in:
MiaoMint
2025-09-23 01:47:48 +08:00
commit 3ce69dbe2d
10 changed files with 1197 additions and 0 deletions

31
pkg/types/port.go Normal file
View File

@@ -0,0 +1,31 @@
package types
import "time"
// PortInfo 表示端口信息
type PortInfo struct {
Port int `json:"port"`
Protocol string `json:"protocol"` // tcp, udp
State string `json:"state"` // LISTEN, ESTABLISHED, etc.
Process string `json:"process"` // 进程名称
PID int `json:"pid"` // 进程ID
ServiceName string `json:"serviceName"` // 识别出的服务名称
ServiceURL string `json:"serviceURL"` // 服务访问URL如果是HTTP服务
LastSeen time.Time `json:"lastSeen"` // 最后发现时间
}
// ScanResult 表示扫描结果
type ScanResult struct {
Ports []PortInfo `json:"ports"`
Timestamp time.Time `json:"timestamp"`
TotalPorts int `json:"totalPorts"`
}
// ServiceMapping 表示端口到服务的映射
type ServiceMapping struct {
Port int `json:"port"`
ServiceName string `json:"serviceName"`
Description string `json:"description"`
IsHTTP bool `json:"isHTTP"`
IsHTTPS bool `json:"isHTTPS"`
}