mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-21 01:20:07 +08:00
Some checks failed
Test / test (1.20, macos-13) (push) Waiting to run
Test / test (1.20, macos-latest) (push) Waiting to run
Test / test (1.20, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.20, windows-latest) (push) Waiting to run
Test / test (1.21, macos-13) (push) Waiting to run
Test / test (1.21, macos-latest) (push) Waiting to run
Test / test (1.21, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.21, windows-latest) (push) Waiting to run
Test / test (1.22, macos-13) (push) Waiting to run
Test / test (1.22, macos-latest) (push) Waiting to run
Test / test (1.22, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.22, windows-latest) (push) Waiting to run
Test / test (1.23, macos-13) (push) Waiting to run
Test / test (1.23, macos-latest) (push) Waiting to run
Test / test (1.23, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.23, windows-latest) (push) Waiting to run
Test / test (1.24, macos-13) (push) Waiting to run
Test / test (1.24, macos-latest) (push) Waiting to run
Test / test (1.24, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.24, windows-latest) (push) Waiting to run
Test / test (1.20, ubuntu-latest) (push) Failing after 1s
Test / test (1.21, ubuntu-latest) (push) Failing after 1s
Test / test (1.22, ubuntu-latest) (push) Failing after 1s
Test / test (1.23, ubuntu-latest) (push) Failing after 1s
Test / test (1.24, ubuntu-latest) (push) Failing after 1s
Trigger CMFA Update / trigger-CMFA-update (push) Failing after 1s
43 lines
726 B
Go
43 lines
726 B
Go
package sniffer
|
|
|
|
import "github.com/metacubex/mihomo/constant"
|
|
|
|
type Sniffer interface {
|
|
SupportNetwork() constant.NetWork
|
|
// SniffData must not change input bytes
|
|
SniffData(bytes []byte) (string, error)
|
|
Protocol() string
|
|
SupportPort(port uint16) bool
|
|
}
|
|
|
|
type ReplaceDomain func(metadata *constant.Metadata, host string)
|
|
|
|
type MultiPacketSniffer interface {
|
|
WrapperSender(packetSender constant.PacketSender, replaceDomain ReplaceDomain) constant.PacketSender
|
|
}
|
|
|
|
const (
|
|
TLS Type = iota
|
|
HTTP
|
|
QUIC
|
|
)
|
|
|
|
var (
|
|
List = []Type{TLS, HTTP, QUIC}
|
|
)
|
|
|
|
type Type int
|
|
|
|
func (rt Type) String() string {
|
|
switch rt {
|
|
case TLS:
|
|
return "TLS"
|
|
case HTTP:
|
|
return "HTTP"
|
|
case QUIC:
|
|
return "QUIC"
|
|
default:
|
|
return "Unknown"
|
|
}
|
|
}
|