fix log prefix

This commit is contained in:
xvzc 2024-07-22 20:58:30 +09:00
parent a93b564d60
commit ee8f7da458
3 changed files with 9 additions and 9 deletions

View File

@ -9,7 +9,7 @@ import (
"github.com/xvzc/SpoofDPI/packet" "github.com/xvzc/SpoofDPI/packet"
) )
func (pxy *Proxy) HandleHttp(lConn *net.TCPConn, pkt *packet.HttpPacket, ip string) { func (pxy *Proxy) handleHttp(lConn *net.TCPConn, pkt *packet.HttpPacket, ip string) {
pkt.Tidy() pkt.Tidy()
// Create a connection to the requested server // Create a connection to the requested server

View File

@ -8,7 +8,7 @@ import (
"github.com/xvzc/SpoofDPI/packet" "github.com/xvzc/SpoofDPI/packet"
) )
func (pxy *Proxy) HandleHttps(lConn *net.TCPConn, initPkt *packet.HttpPacket, ip string) { func (pxy *Proxy) handleHttps(lConn *net.TCPConn, initPkt *packet.HttpPacket, ip string) {
// Create a connection to the requested server // Create a connection to the requested server
var port int = 443 var port int = 443
var err error var err error
@ -57,8 +57,8 @@ func (pxy *Proxy) HandleHttps(lConn *net.TCPConn, initPkt *packet.HttpPacket, ip
chPkt := packet.NewHttpsPacket(clientHello) chPkt := packet.NewHttpsPacket(clientHello)
lConn.SetLinger(3) // lConn.SetLinger(3)
rConn.SetLinger(3) // rConn.SetLinger(3)
go Serve(rConn, lConn, "[HTTPS]", rConn.RemoteAddr().String(), initPkt.Domain(), pxy.timeout) go Serve(rConn, lConn, "[HTTPS]", rConn.RemoteAddr().String(), initPkt.Domain(), pxy.timeout)
@ -111,7 +111,7 @@ func (pxy *Proxy) patternExists() bool {
return pxy.allowedPattern != nil || pxy.allowedUrls != nil return pxy.allowedPattern != nil || pxy.allowedUrls != nil
} }
func (p *Proxy) patternMatches(bytes []byte) bool { func (pxy *Proxy) patternMatches(bytes []byte) bool {
return (p.allowedPattern != nil && p.allowedPattern.Match(bytes)) || return (pxy.allowedPattern != nil && pxy.allowedPattern.Match(bytes)) ||
(p.allowedUrls != nil && p.allowedUrls.Match(bytes)) (pxy.allowedUrls != nil && pxy.allowedUrls.Match(bytes))
} }

View File

@ -91,10 +91,10 @@ func (pxy *Proxy) Start() {
if pkt.IsConnectMethod() { if pkt.IsConnectMethod() {
log.Debug("[PROXY] Start HTTPS") log.Debug("[PROXY] Start HTTPS")
pxy.HandleHttps(conn.(*net.TCPConn), pkt, ip) pxy.handleHttps(conn.(*net.TCPConn), pkt, ip)
} else { } else {
log.Debug("[PROXY] Start HTTP") log.Debug("[PROXY] Start HTTP")
pxy.HandleHttp(conn.(*net.TCPConn), pkt, ip) pxy.handleHttp(conn.(*net.TCPConn), pkt, ip)
} }
}() }()
} }