@@ -27,9 +27,9 @@ import (
27
27
"strings"
28
28
"syscall"
29
29
30
- "cloud.google.com/go/cloudsqlconn "
31
- "github.com/GoogleCloudPlatform/cloudsql- proxy/v2/cloudsql "
32
- "github.com/GoogleCloudPlatform/cloudsql- proxy/v2 /internal/proxy"
30
+ "cloud.google.com/go/alloydbconn "
31
+ "github.com/GoogleCloudPlatform/alloydb-auth- proxy/alloydb "
32
+ "github.com/GoogleCloudPlatform/alloydb-auth- proxy/internal/proxy"
33
33
"github.com/spf13/cobra"
34
34
)
35
35
42
42
43
43
func init () {
44
44
versionString = strings .TrimSpace (versionString )
45
- userAgent = "cloud-sql -auth-proxy/" + versionString
45
+ userAgent = "alloy-db -auth-proxy/" + versionString
46
46
}
47
47
48
48
// Execute adds all child commands to the root command and sets flags appropriately.
@@ -57,7 +57,7 @@ func Execute() {
57
57
}
58
58
}
59
59
60
- // Command represents an invocation of the Cloud SQL Auth Proxy.
60
+ // Command represents an invocation of the AlloyDB Auth Proxy.
61
61
type Command struct {
62
62
* cobra.Command
63
63
conf * proxy.Config
@@ -67,8 +67,8 @@ type Command struct {
67
67
type Option func (* proxy.Config )
68
68
69
69
// WithDialer configures the Command to use the provided dialer to connect to
70
- // Cloud SQL instances.
71
- func WithDialer (d cloudsql .Dialer ) Option {
70
+ // AlloyDB instances.
71
+ func WithDialer (d alloydb .Dialer ) Option {
72
72
return func (c * proxy.Config ) {
73
73
c .Dialer = d
74
74
}
@@ -84,13 +84,13 @@ func NewCommand(opts ...Option) *Command {
84
84
}
85
85
86
86
cmd := & cobra.Command {
87
- Use : "cloud_sql_proxy instance_connection_name..." ,
87
+ Use : "alloydb-auth-proxy instance_connection_name..." ,
88
88
Version : versionString ,
89
- Short : "cloud_sql_proxy provides a secure way to authorize connections to Cloud SQL ." ,
90
- Long : `The Cloud SQL Auth proxy provides IAM-based authorization and encryption when
91
- connecting to Cloud SQL instances. It listens on a local port and forwards connections
92
- to your instance's IP address, providing a secure connection without having to manage
93
- any client SSL certificates.` ,
89
+ Short : "alloydb-auth-proxy provides a secure way to authorize connections to AlloyDB ." ,
90
+ Long : `The AlloyDB Auth proxy provides IAM-based authorization and encryption when
91
+ connecting to AlloyDB instances. It listens on a local port and forwards
92
+ connections to your instance's IP address, providing a secure connection
93
+ without having to manage any client SSL certificates.` ,
94
94
Args : func (cmd * cobra.Command , args []string ) error {
95
95
err := parseConfig (cmd , c .conf , args )
96
96
if err != nil {
@@ -113,8 +113,8 @@ any client SSL certificates.`,
113
113
114
114
// Global and per instance flags
115
115
cmd .PersistentFlags ().StringVarP (& c .conf .Addr , "address" , "a" , "127.0.0.1" ,
116
- "Address on which to bind Cloud SQL instance listeners." )
117
- cmd .PersistentFlags ().IntVarP (& c .conf .Port , "port" , "p" , 0 ,
116
+ "Address on which to bind AlloyDB instance listeners." )
117
+ cmd .PersistentFlags ().IntVarP (& c .conf .Port , "port" , "p" , 5432 ,
118
118
"Initial port to use for listeners. Subsequent listeners increment from this value." )
119
119
120
120
c .Command = cmd
@@ -142,7 +142,7 @@ func parseConfig(cmd *cobra.Command, conf *proxy.Config, args []string) error {
142
142
case conf .CredentialsFile != "" :
143
143
cmd .Printf ("Authorizing with the credentials file at %q\n " , conf .CredentialsFile )
144
144
default :
145
- cmd .Printf ("Authorizing with Application Default Credentials" )
145
+ cmd .Println ("Authorizing with Application Default Credentials" )
146
146
}
147
147
148
148
var ics []proxy.InstanceConnConfig
@@ -227,9 +227,9 @@ func runSignalWrapper(cmd *Command) error {
227
227
// Otherwise, initialize a new one.
228
228
d := cmd .conf .Dialer
229
229
if d == nil {
230
- opts := append (cmd .conf .DialerOpts (), cloudsqlconn .WithUserAgent (userAgent ))
230
+ opts := append (cmd .conf .DialerOpts (), alloydbconn .WithUserAgent (userAgent ))
231
231
var err error
232
- d , err = cloudsqlconn .NewDialer (ctx , opts ... )
232
+ d , err = alloydbconn .NewDialer (ctx , opts ... )
233
233
if err != nil {
234
234
shutdownCh <- fmt .Errorf ("error initializing dialer: %v" , err )
235
235
return
0 commit comments