-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse.go
41 lines (30 loc) · 1015 Bytes
/
parse.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package example
import (
"fmt"
clienthint "github.com/hentaiOS-Infrastructure/fasthttp-go-client-hints"
"github.com/valyala/fasthttp"
)
func Handler(ctx *fasthttp.RequestCtx) {
clientHints, err := clienthint.Parse(&ctx.Request.Header)
if err != nil {
return
}
// Sec-CH-UA field
fmt.Println("Brand: ", clientHints.Brand.Brand)
fmt.Println("Brand Version: ", clientHints.BrandVersion)
fmt.Println("Brands: ", clientHints.Brands)
// Sec-Ch-Ua-Platform filed
fmt.Println("Platform: ", clientHints.Platform)
// Sec-CH-UA-Platform-Version filed
fmt.Println("Platform Version: ", clientHints.PlatformVersion)
// Sec-Ch-Ua-Mobile filed
fmt.Println("IsMobile: ", clientHints.IsMobile)
// Sec-CH-UA-Arch filed
fmt.Println("Arch: ", clientHints.Architecture)
// Sec-CH-UA-Bitness filed
fmt.Println("Bitness: ", clientHints.Bitness)
// Sec-CH-UA-Model filed
fmt.Println("Model: ", clientHints.Model)
// Sec-Ch-Ua-Full-Version filed
fmt.Println("Full Version: ", clientHints.FullVersion)
}