Skip to content

Commit

Permalink
Set userAgent version, remove timeout, wss -> https
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Stadermann committed Nov 20, 2024
1 parent 877e42b commit c06ec01
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions golang/vaas/v3/pkg/vaas/vaas.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import (
// TODO: useCache, useHashLookup ???

const (
// TODO: version
userAgent = "golang-vaas-sdk"
userAgent = "Go/3.0.8-alpha"
)

// Errors returned by the VaaS API
Expand Down Expand Up @@ -59,7 +58,6 @@ func New(options options.VaasOptions, vaasURL *url.URL, authenticator authentica
vaasURL: vaasURL,
authenticator: authenticator,
httpClient: &http.Client{
Timeout: 1 * time.Minute,
Transport: &http.Transport{
// Disable HTTP/2
TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
Expand All @@ -72,7 +70,7 @@ func New(options options.VaasOptions, vaasURL *url.URL, authenticator authentica
// NewWithDefaultEndpoint creates a new instance of the Vaas struct with a default endpoint.
// It represents a client for interacting with a Vaas service.
func NewWithDefaultEndpoint(options options.VaasOptions, authenticator authenticator.Authenticator) Vaas {
vaasURL, _ := url.Parse("wss://gateway.production.vaas.gdatasecurity.de")
vaasURL, _ := url.Parse("https://gateway.production.vaas.gdatasecurity.de")
return New(options, vaasURL, authenticator)
}

Expand Down Expand Up @@ -137,7 +135,7 @@ func (v *vaas) newAuthenticatedRequest(ctx context.Context, method string, url s
//
// Example usage:
//
// vaasClient := vaas.New(options, "wss://example.authentication.endpoint")
// vaasClient := vaas.New(options, "https://example.authentication.endpoint")
// ctx := context.Background()
// sha256 := "..."
// verdict, err := vaasClient.ForSha256(ctx, sha256)
Expand Down Expand Up @@ -194,7 +192,7 @@ func (v *vaas) ForSha256(ctx context.Context, sha256 string) (msg.VaasVerdict, e
//
// Example usage:
//
// vaasClient := vaas.New(options, "wss://example.authentication.endpoint")
// vaasClient := vaas.New(options, "https://example.authentication.endpoint")
// ctx := context.Background()
// filePath := "path/to/file.txt"
// verdict, err := vaasClient.ForFile(ctx, filePath)
Expand Down Expand Up @@ -268,7 +266,7 @@ func (v *vaas) upload(ctx context.Context, file io.Reader, contentLength int64)
//
// Example usage:
//
// vaasClient := vaas.New(options, "wss://example.authentication.endpoint")
// vaasClient := vaas.New(options, "https://example.authentication.endpoint")
// ctx := context.Background()
// verdict, err := vaasClient.ForUrl(ctx, "https://example.com/examplefile")
// if err != nil {
Expand All @@ -286,7 +284,7 @@ func (v *vaas) ForUrl(ctx context.Context, url string) (msg.VaasVerdict, error)
//
// Example usage:
//
// vaasClient := vaas.New(options, "wss://example.authentication.endpoint")
// vaasClient := vaas.New(options, "https://example.authentication.endpoint")
// ctx := context.Background()
// contentLength := 1234
// verdict, err := vaasClient.ForStream(ctx, stream, contentLength)
Expand Down

0 comments on commit c06ec01

Please sign in to comment.