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"
|
||||
"time"
|
||||
|
||||
"software.sslmate.com/src/certspotter/ctclient"
|
||||
"software.sslmate.com/src/certspotter/loglist"
|
||||
"software.sslmate.com/src/certspotter/monitor"
|
||||
)
|
||||
@ -139,6 +140,7 @@ func appendFunc(slice *[]string) func(string) error {
|
||||
|
||||
func main() {
|
||||
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 {
|
||||
batchSize bool
|
||||
|
@ -24,6 +24,8 @@ import (
|
||||
"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.
|
||||
func NewHTTPClient(dialContext func(context.Context, string, string) (net.Conn, error)) *http.Client {
|
||||
return &http.Client{
|
||||
@ -61,7 +63,7 @@ func get(ctx context.Context, httpClient *http.Client, fullURL string) ([]byte,
|
||||
if err != nil {
|
||||
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 {
|
||||
httpClient = defaultHTTPClient
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var UserAgent = "certspotter"
|
||||
var UserAgent = "software.sslmate.com/src/certspotter"
|
||||
|
||||
type ModificationToken struct {
|
||||
etag string
|
||||
|
Loading…
x
Reference in New Issue
Block a user