Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add default useragent #17

Merged
merged 1 commit into from
May 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ import (

"cloud.google.com/cloudsqlconn/internal/cloudsql"
"golang.org/x/net/proxy"
"google.golang.org/api/option"
sqladmin "google.golang.org/api/sqladmin/v1beta4"
)

const (
// versionString indicates the version of this library.
versionString = "0.1.0-dev"
userAgent = "cloud-sql-go-connector/" + versionString

// defaultTCPKeepAlive is the default keep alive value used on connections to a Cloud SQL instance.
defaultTCPKeepAlive = 30 * time.Second
// serverProxyPort is the port the server-side proxy receives connections on.
Expand Down Expand Up @@ -74,6 +79,7 @@ type Dialer struct {
func NewDialer(ctx context.Context, opts ...DialerOption) (*Dialer, error) {
cfg := &dialerConfig{
refreshTimeout: 30 * time.Second,
sqladminOpts: []option.ClientOption{option.WithUserAgent(userAgent)},
}
for _, opt := range opts {
opt(cfg)
Expand Down