add sid for connector log

This commit is contained in:
ginuerzh
2024-09-20 18:20:57 +08:00
parent e37213ac01
commit e09ec08881
22 changed files with 142 additions and 46 deletions
+2
View File
@@ -6,6 +6,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -57,6 +58,7 @@ func (c *directConnector) Connect(ctx context.Context, _ net.Conn, network, addr
"local": localAddr, "local": localAddr,
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -6,6 +6,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -38,6 +39,7 @@ func (c *forwardConnector) Connect(ctx context.Context, conn net.Conn, network,
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -14,6 +14,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
"github.com/go-gost/core/logger" "github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/internal/util/socks" "github.com/go-gost/x/internal/util/socks"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -48,6 +49,7 @@ func (c *httpConnector) Connect(ctx context.Context, conn net.Conn, network, add
"remote": conn.RemoteAddr().String(), "remote": conn.RemoteAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -15,6 +15,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
"github.com/go-gost/core/logger" "github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -48,6 +49,7 @@ func (c *http2Connector) Connect(ctx context.Context, conn net.Conn, network, ad
"remote": conn.RemoteAddr().String(), "remote": conn.RemoteAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -10,6 +10,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
"github.com/go-gost/relay" "github.com/go-gost/relay"
ctxvalue "github.com/go-gost/x/ctx"
relay_util "github.com/go-gost/x/internal/util/relay" relay_util "github.com/go-gost/x/internal/util/relay"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -44,6 +45,7 @@ func (c *relayConnector) Connect(ctx context.Context, conn net.Conn, network, ad
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -6,6 +6,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -38,6 +39,7 @@ func (c *serialConnector) Connect(ctx context.Context, conn net.Conn, network, a
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -6,6 +6,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -39,6 +40,7 @@ func (c *sniConnector) Connect(ctx context.Context, conn net.Conn, network, addr
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -11,6 +11,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
"github.com/go-gost/gosocks4" "github.com/go-gost/gosocks4"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -45,6 +46,7 @@ func (c *socks4Connector) Connect(ctx context.Context, conn net.Conn, network, a
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -12,6 +12,7 @@ import (
"github.com/go-gost/core/logger" "github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
"github.com/go-gost/gosocks5" "github.com/go-gost/gosocks5"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/internal/util/socks" "github.com/go-gost/x/internal/util/socks"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -97,6 +98,7 @@ func (c *socks5Connector) Connect(ctx context.Context, conn net.Conn, network, a
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -10,6 +10,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
"github.com/go-gost/gosocks5" "github.com/go-gost/gosocks5"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/internal/util/ss" "github.com/go-gost/x/internal/util/ss"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
"github.com/shadowsocks/go-shadowsocks2/core" "github.com/shadowsocks/go-shadowsocks2/core"
@@ -56,6 +57,7 @@ func (c *ssConnector) Connect(ctx context.Context, conn net.Conn, network, addre
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -8,6 +8,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/internal/util/relay" "github.com/go-gost/x/internal/util/relay"
"github.com/go-gost/x/internal/util/ss" "github.com/go-gost/x/internal/util/ss"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
@@ -55,6 +56,7 @@ func (c *ssuConnector) Connect(ctx context.Context, conn net.Conn, network, addr
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -7,6 +7,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
ssh_util "github.com/go-gost/x/internal/util/ssh" ssh_util "github.com/go-gost/x/internal/util/ssh"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -40,6 +41,7 @@ func (c *sshdConnector) Connect(ctx context.Context, conn net.Conn, network, add
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -6,6 +6,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -38,6 +39,7 @@ func (c *tcpConnector) Connect(ctx context.Context, conn net.Conn, network, addr
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+1
View File
@@ -43,6 +43,7 @@ func (c *tunnelConnector) Connect(ctx context.Context, conn net.Conn, network, a
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2
View File
@@ -6,6 +6,7 @@ import (
"github.com/go-gost/core/connector" "github.com/go-gost/core/connector"
md "github.com/go-gost/core/metadata" md "github.com/go-gost/core/metadata"
ctxvalue "github.com/go-gost/x/ctx"
"github.com/go-gost/x/registry" "github.com/go-gost/x/registry"
) )
@@ -38,6 +39,7 @@ func (c *unixConnector) Connect(ctx context.Context, conn net.Conn, network, add
"local": conn.LocalAddr().String(), "local": conn.LocalAddr().String(),
"network": network, "network": network,
"address": address, "address": address,
"sid": string(ctxvalue.SidFromContext(ctx)),
}) })
log.Debugf("connect %s/%s", address, network) log.Debugf("connect %s/%s", address, network)
+2 -1
View File
@@ -36,7 +36,7 @@ import (
) )
const ( const (
defaultBodySize = 1024 * 1024 * 10 // 10MB defaultBodySize = 1024 * 1024 // 1MB
) )
func init() { func init() {
@@ -126,6 +126,7 @@ func (h *forwardHandler) Handle(ctx context.Context, conn net.Conn, opts ...hand
if _, ok := conn.(net.PacketConn); ok { if _, ok := conn.(net.PacketConn); ok {
network = "udp" network = "udp"
} }
ro.Network = network
var rw io.ReadWriter = conn var rw io.ReadWriter = conn
var host string var host string
+2 -1
View File
@@ -38,7 +38,7 @@ import (
) )
const ( const (
defaultBodySize = 1024 * 1024 * 10 // 10MB defaultBodySize = 1024 * 1024 // 1MB
) )
func init() { func init() {
@@ -127,6 +127,7 @@ func (h *forwardHandler) Handle(ctx context.Context, conn net.Conn, opts ...hand
if _, ok := conn.(net.PacketConn); ok { if _, ok := conn.(net.PacketConn); ok {
network = "udp" network = "udp"
} }
ro.Network = network
localAddr := convertAddr(conn.LocalAddr()) localAddr := convertAddr(conn.LocalAddr())
+1 -1
View File
@@ -40,7 +40,7 @@ import (
) )
const ( const (
defaultBodySize = 1024 * 1024 * 10 // 10MB defaultBodySize = 1024 * 1024 // 1MB
) )
func init() { func init() {
+1 -1
View File
@@ -31,7 +31,7 @@ import (
) )
const ( const (
defaultBodySize = 1024 * 1024 * 10 // 10MB defaultBodySize = 1024 * 1024 // 1MB
) )
type entrypoint struct { type entrypoint struct {
+6 -19
View File
@@ -25,7 +25,7 @@ func Sniffing(ctx context.Context, rdw io.ReadWriter) (rw io.ReadWriter, host st
if err == nil && if err == nil &&
hdr[0] == dissector.Handshake && hdr[0] == dissector.Handshake &&
(tlsVersion >= tls.VersionTLS10 && tlsVersion <= tls.VersionTLS13) { (tlsVersion >= tls.VersionTLS10 && tlsVersion <= tls.VersionTLS13) {
rw, host, err = sniffSNI(ctx, rw) rw, host, err = sniffSNI(rw)
protocol = ProtoTLS protocol = ProtoTLS
return return
} }
@@ -48,32 +48,19 @@ func Sniffing(ctx context.Context, rdw io.ReadWriter) (rw io.ReadWriter, host st
return return
} }
func sniffSNI(ctx context.Context, rw io.ReadWriter) (io.ReadWriter, string, error) { func sniffSNI(rw io.ReadWriter) (io.ReadWriter, string, error) {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
host, err := getServerName(ctx, io.TeeReader(rw, buf)) host, err := getServerName(io.TeeReader(rw, buf))
rw = xio.NewReadWriter(io.MultiReader(buf, rw), rw) rw = xio.NewReadWriter(io.MultiReader(buf, rw), rw)
return rw, host, err return rw, host, err
} }
func getServerName(ctx context.Context, r io.Reader) (host string, err error) { func getServerName(r io.Reader) (host string, err error) {
record, err := dissector.ReadRecord(r) clientHello, err := dissector.ParseClientHello(r)
if err != nil { if err != nil {
return return
} }
host = clientHello.ServerName
clientHello := dissector.ClientHelloMsg{}
if err = clientHello.Decode(record.Opaque); err != nil {
return
}
for _, ext := range clientHello.Extensions {
if ext.Type() == dissector.ExtServerName {
snExtension := ext.(*dissector.ServerNameExtension)
host = snExtension.Name
break
}
}
return return
} }
+92 -23
View File
@@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"net" "net"
"os" "os"
"strconv"
"strings" "strings"
"time" "time"
@@ -20,7 +21,9 @@ const (
VersionTLS13 = "VersionTLS13" VersionTLS13 = "VersionTLS13"
) )
// Cipher suites from https://pkg.go.dev/crypto/tls#pkg-constants
const ( const (
// TLS 1.0 - 1.2 cipher suites.
TLS_RSA_WITH_RC4_128_SHA = "TLS_RSA_WITH_RC4_128_SHA" TLS_RSA_WITH_RC4_128_SHA = "TLS_RSA_WITH_RC4_128_SHA"
TLS_RSA_WITH_3DES_EDE_CBC_SHA = "TLS_RSA_WITH_3DES_EDE_CBC_SHA" TLS_RSA_WITH_3DES_EDE_CBC_SHA = "TLS_RSA_WITH_3DES_EDE_CBC_SHA"
TLS_RSA_WITH_AES_128_CBC_SHA = "TLS_RSA_WITH_AES_128_CBC_SHA" TLS_RSA_WITH_AES_128_CBC_SHA = "TLS_RSA_WITH_AES_128_CBC_SHA"
@@ -43,8 +46,74 @@ const (
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256"
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256"
// TLS 1.3 cipher suites.
TLS_AES_128_GCM_SHA256 = "TLS_AES_128_GCM_SHA256"
TLS_AES_256_GCM_SHA384 = "TLS_AES_256_GCM_SHA384"
TLS_CHACHA20_POLY1305_SHA256 = "TLS_CHACHA20_POLY1305_SHA256"
// TLS_FALLBACK_SCSV isn't a standard cipher suite but an indicator
// that the client is doing version fallback. See RFC 7507.
TLS_FALLBACK_SCSV = "TLS_FALLBACK_SCSV"
) )
var (
cipherSuites = map[uint16]string{
tls.TLS_RSA_WITH_RC4_128_SHA: TLS_RSA_WITH_RC4_128_SHA,
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: TLS_RSA_WITH_3DES_EDE_CBC_SHA,
tls.TLS_RSA_WITH_AES_128_CBC_SHA: TLS_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_RSA_WITH_AES_256_CBC_SHA: TLS_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_RSA_WITH_AES_128_CBC_SHA256: TLS_RSA_WITH_AES_128_CBC_SHA256,
tls.TLS_RSA_WITH_AES_128_GCM_SHA256: TLS_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_RSA_WITH_AES_256_GCM_SHA384: TLS_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: TLS_ECDHE_RSA_WITH_RC4_128_SHA,
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,
tls.TLS_AES_128_GCM_SHA256: TLS_AES_128_GCM_SHA256,
tls.TLS_AES_256_GCM_SHA384: TLS_AES_256_GCM_SHA384,
tls.TLS_CHACHA20_POLY1305_SHA256: TLS_CHACHA20_POLY1305_SHA256,
}
versions = map[uint16]string{
tls.VersionSSL30: "sslv3",
tls.VersionTLS10: "tls1.0",
tls.VersionTLS11: "tls1.1",
tls.VersionTLS12: "tls1.2",
tls.VersionTLS13: "tls1.3",
}
)
type CipherSuite uint16
func (cs CipherSuite) String() string {
if v, ok := cipherSuites[uint16(cs)]; ok {
return v
}
return strconv.Itoa(int(cs))
}
type Version uint16
func (ver Version) String() string {
if v, ok := versions[uint16(ver)]; ok {
return v
}
return strconv.Itoa(int(ver))
}
// LoadDefaultConfig loads the certificate from cert & key files and optional CA file. // LoadDefaultConfig loads the certificate from cert & key files and optional CA file.
func LoadDefaultConfig(certFile, keyFile, caFile string) (*tls.Config, error) { func LoadDefaultConfig(certFile, keyFile, caFile string) (*tls.Config, error) {
cert, err := tls.LoadX509KeyPair(certFile, keyFile) cert, err := tls.LoadX509KeyPair(certFile, keyFile)
@@ -175,50 +244,50 @@ func SetTLSOptions(cfg *tls.Config, opts *config.TLSOptions) {
cfg.MaxVersion = tls.VersionTLS13 cfg.MaxVersion = tls.VersionTLS13
} }
for _, v := range opts.CipherSuites { for _, v := range opts.CipherSuites {
switch strings.ToLower(v) { switch strings.ToUpper(v) {
case strings.ToLower(TLS_RSA_WITH_RC4_128_SHA): case TLS_RSA_WITH_RC4_128_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_RC4_128_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_RC4_128_SHA)
case strings.ToLower(TLS_RSA_WITH_3DES_EDE_CBC_SHA): case TLS_RSA_WITH_3DES_EDE_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA)
case strings.ToLower(TLS_RSA_WITH_AES_128_CBC_SHA): case TLS_RSA_WITH_AES_128_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_128_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_128_CBC_SHA)
case strings.ToLower(TLS_RSA_WITH_AES_256_CBC_SHA): case TLS_RSA_WITH_AES_256_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_256_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_256_CBC_SHA)
case strings.ToLower(TLS_RSA_WITH_AES_128_CBC_SHA256): case TLS_RSA_WITH_AES_128_CBC_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_128_CBC_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_128_CBC_SHA256)
case strings.ToLower(TLS_RSA_WITH_AES_128_GCM_SHA256): case TLS_RSA_WITH_AES_128_GCM_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_128_GCM_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_128_GCM_SHA256)
case strings.ToLower(TLS_RSA_WITH_AES_256_GCM_SHA384): case TLS_RSA_WITH_AES_256_GCM_SHA384:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_256_GCM_SHA384) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_RSA_WITH_AES_256_GCM_SHA384)
case strings.ToLower(TLS_ECDHE_ECDSA_WITH_RC4_128_SHA): case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA)
case strings.ToLower(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA): case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA)
case strings.ToLower(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA): case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA)
case strings.ToLower(TLS_ECDHE_RSA_WITH_RC4_128_SHA): case TLS_ECDHE_RSA_WITH_RC4_128_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA)
case strings.ToLower(TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA): case TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA)
case strings.ToLower(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA): case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA)
case strings.ToLower(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA): case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA)
case strings.ToLower(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256): case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256)
case strings.ToLower(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256): case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256)
case strings.ToLower(TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256): case TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256)
case strings.ToLower(TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256): case TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)
case strings.ToLower(TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384): case TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384)
case strings.ToLower(TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384): case TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384)
case strings.ToLower(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256): case TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256)
case strings.ToLower(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256): case TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:
cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256) cfg.CipherSuites = append(cfg.CipherSuites, tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256)
} }
} }
+9
View File
@@ -38,6 +38,14 @@ type HTTPRecorderObject struct {
Response HTTPResponseRecorderObject `json:"response"` Response HTTPResponseRecorderObject `json:"response"`
} }
type TLSRecorderObject struct {
ServerName string `json:"serverName"`
CipherSuite string `json:"cipherSuite"`
CompressionMethod uint8 `json:"compressionMethod"`
Proto string `json:"proto"`
Version string `json:"version"`
}
type DNSRecorderObject struct { type DNSRecorderObject struct {
ID int `json:"id"` ID int `json:"id"`
Name string `json:"name"` Name string `json:"name"`
@@ -58,6 +66,7 @@ type HandlerRecorderObject struct {
ClientIP string `json:"clientIP"` ClientIP string `json:"clientIP"`
ClientID string `json:"clientID,omitempty"` ClientID string `json:"clientID,omitempty"`
HTTP *HTTPRecorderObject `json:"http,omitempty"` HTTP *HTTPRecorderObject `json:"http,omitempty"`
TLS *TLSRecorderObject `json:"tls,omitempty"`
DNS *DNSRecorderObject `json:"dns,omitempty"` DNS *DNSRecorderObject `json:"dns,omitempty"`
Err string `json:"err,omitempty"` Err string `json:"err,omitempty"`
Duration time.Duration `json:"duration"` Duration time.Duration `json:"duration"`