mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-06 05:08:28 +02:00

- Removed Go HTTP client UA - Added optional bypass of websocket origin check #107 - Added basic forward proxy for debug - Fixed UI error in network utils tab
68 lines
907 B
Go
68 lines
907 B
Go
package cproxy
|
|
|
|
import (
|
|
"io"
|
|
"net"
|
|
"net/http"
|
|
)
|
|
|
|
type (
|
|
Filter interface {
|
|
IsAuthorized(http.ResponseWriter, *http.Request) bool
|
|
}
|
|
|
|
clientConnector interface {
|
|
Connect(http.ResponseWriter) Socket
|
|
}
|
|
)
|
|
|
|
type (
|
|
Dialer interface {
|
|
Dial(string) Socket
|
|
}
|
|
|
|
serverConnector interface {
|
|
Connect(Socket, string) proxy
|
|
}
|
|
|
|
initializer interface {
|
|
Initialize(Socket, Socket) bool
|
|
}
|
|
|
|
proxy interface {
|
|
Proxy()
|
|
}
|
|
)
|
|
|
|
type (
|
|
Socket interface {
|
|
io.ReadWriteCloser
|
|
RemoteAddr() net.Addr
|
|
}
|
|
|
|
tcpSocket interface {
|
|
Socket
|
|
CloseRead() error
|
|
CloseWrite() error
|
|
}
|
|
)
|
|
|
|
type (
|
|
monitor interface {
|
|
Measure(int)
|
|
}
|
|
logger interface {
|
|
Printf(string, ...interface{})
|
|
}
|
|
)
|
|
|
|
const (
|
|
MeasurementHTTPRequest int = iota
|
|
MeasurementBadMethod
|
|
MeasurementUnauthorizedRequest
|
|
MeasurementClientConnectionFailed
|
|
MeasurementServerConnectionFailed
|
|
MeasurementProxyReady
|
|
MeasurementProxyComplete
|
|
)
|