mirror of
https://github.com/SSLMate/certspotter.git
synced 2025-06-27 10:15:33 +02:00
Send helpful User-Agent string with all requests
This commit is contained in:
parent
187aed078c
commit
a4048f47f8
@ -25,6 +25,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"software.sslmate.com/src/certspotter/ctclient"
|
||||||
"software.sslmate.com/src/certspotter/loglist"
|
"software.sslmate.com/src/certspotter/loglist"
|
||||||
"software.sslmate.com/src/certspotter/monitor"
|
"software.sslmate.com/src/certspotter/monitor"
|
||||||
)
|
)
|
||||||
@ -139,6 +140,7 @@ func appendFunc(slice *[]string) func(string) error {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
loglist.UserAgent = fmt.Sprintf("certspotter/%s (%s; %s; %s)", certspotterVersion(), runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
loglist.UserAgent = fmt.Sprintf("certspotter/%s (%s; %s; %s)", certspotterVersion(), runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||||||
|
ctclient.UserAgent = fmt.Sprintf("certspotter/%s (+https://github.com/SSLMate/certspotter)", certspotterVersion())
|
||||||
|
|
||||||
var flags struct {
|
var flags struct {
|
||||||
batchSize bool
|
batchSize bool
|
||||||
|
@ -24,6 +24,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var UserAgent = "software.sslmate.com/src/certspotter"
|
||||||
|
|
||||||
// Create an HTTP client suitable for communicating with CT logs. dialContext, if non-nil, is used for dialing.
|
// Create an HTTP client suitable for communicating with CT logs. dialContext, if non-nil, is used for dialing.
|
||||||
func NewHTTPClient(dialContext func(context.Context, string, string) (net.Conn, error)) *http.Client {
|
func NewHTTPClient(dialContext func(context.Context, string, string) (net.Conn, error)) *http.Client {
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
@ -61,7 +63,7 @@ func get(ctx context.Context, httpClient *http.Client, fullURL string) ([]byte,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
request.Header.Set("User-Agent", "") // Don't send a User-Agent to make life harder for malicious logs
|
request.Header.Set("User-Agent", UserAgent)
|
||||||
|
|
||||||
if httpClient == nil {
|
if httpClient == nil {
|
||||||
httpClient = defaultHTTPClient
|
httpClient = defaultHTTPClient
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var UserAgent = "certspotter"
|
var UserAgent = "software.sslmate.com/src/certspotter"
|
||||||
|
|
||||||
type ModificationToken struct {
|
type ModificationToken struct {
|
||||||
etag string
|
etag string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user