Check fingerprint ptr before usage
This commit is contained in:
2
go.mod
2
go.mod
@@ -15,7 +15,6 @@ require (
|
|||||||
github.com/tetratelabs/wazero v1.9.0
|
github.com/tetratelabs/wazero v1.9.0
|
||||||
github.com/yl2chen/cidranger v1.0.2
|
github.com/yl2chen/cidranger v1.0.2
|
||||||
golang.org/x/crypto v0.37.0
|
golang.org/x/crypto v0.37.0
|
||||||
golang.org/x/net v0.39.0
|
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,6 +25,7 @@ require (
|
|||||||
github.com/kevinpollet/nego v0.0.0-20211010160919-a65cd48cee43 // indirect
|
github.com/kevinpollet/nego v0.0.0-20211010160919-a65cd48cee43 // indirect
|
||||||
github.com/stoewer/go-strcase v1.3.0 // indirect
|
github.com/stoewer/go-strcase v1.3.0 // indirect
|
||||||
golang.org/x/exp v0.0.0 // indirect
|
golang.org/x/exp v0.0.0 // indirect
|
||||||
|
golang.org/x/net v0.39.0 // indirect
|
||||||
golang.org/x/text v0.24.0 // indirect
|
golang.org/x/text v0.24.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250409194420-de1ac958c67a // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20250409194420-de1ac958c67a // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250409194420-de1ac958c67a // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250409194420-de1ac958c67a // indirect
|
||||||
|
20
lib/http.go
20
lib/http.go
@@ -143,8 +143,12 @@ func GetLoggerForRequest(r *http.Request) *slog.Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if fp := utils.GetTLSFingerprint(r); fp != nil {
|
if fp := utils.GetTLSFingerprint(r); fp != nil {
|
||||||
args = append(args, "ja3n", fp.JA3N().String())
|
if ja3n := fp.JA3N(); ja3n != nil {
|
||||||
args = append(args, "ja4", fp.JA4().String())
|
args = append(args, "ja3n", ja3n)
|
||||||
|
}
|
||||||
|
if ja4 := fp.JA4(); ja4 != nil {
|
||||||
|
args = append(args, "ja4", ja4.String())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return slog.With(args...)
|
return slog.With(args...)
|
||||||
}
|
}
|
||||||
@@ -430,10 +434,14 @@ func (state *State) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
var ja3n, ja4 string
|
var ja3n, ja4 string
|
||||||
if fp := utils.GetTLSFingerprint(r); fp != nil {
|
if fp := utils.GetTLSFingerprint(r); fp != nil {
|
||||||
ja3n = fp.JA3N().String()
|
if ja3nPtr := fp.JA3N(); ja3nPtr != nil {
|
||||||
ja4 = fp.JA4().String()
|
ja3n = ja3nPtr.String()
|
||||||
r.Header.Set("X-TLS-Fingerprint-JA3N", ja3n)
|
r.Header.Set("X-TLS-Fingerprint-JA3N", ja3n)
|
||||||
r.Header.Set("X-TLS-Fingerprint-JA4", ja4)
|
}
|
||||||
|
if ja4Ptr := fp.JA4(); ja4Ptr != nil {
|
||||||
|
ja4 = ja4Ptr.String()
|
||||||
|
r.Header.Set("X-TLS-Fingerprint-JA4", ja4)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.ProgramEnv = map[string]any{
|
data.ProgramEnv = map[string]any{
|
||||||
|
Reference in New Issue
Block a user