Skip to content

Commit

Permalink
feat: support handshakeKey (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
veezhang authored Jan 10, 2024
1 parent 98d720f commit ac556b5
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 31 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ client:
* `client.address`: **Required**. The address of graph in NebulaGraph.
* `client.user`: **Optional**. The user of NebulaGraph. The default value is `root`.
* `client.password`: **Optional**. The password of NebulaGraph. The default value is `nebula`.
* `client.handshakeKey`: **Optional**. The handshakeKey of NebulaGraph.
* `client.ssl`: **Optional**. SSL related configuration.
* `client.ssl.enable`: **Optional**. Specifies whether to enable ssl authentication. The default value is `false`.
* `client.ssl.certPath`: **Required**. Specifies the path of the certificate file.
Expand Down Expand Up @@ -336,11 +337,13 @@ csv:
delimiter: ","
withHeader: false
lazyQuotes: false
comment: ""
```

* `delimiter`: **Optional**. Specifies the delimiter for the CSV files. The default value is `","`. And only a 1-character string delimiter is supported.
* `withHeader`: **Optional**. Specifies whether to ignore the first record in csv file. The default value is `false`.
* `lazyQuotes`: **Optional**. If lazyQuotes is true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field.
* `comment`: **Optional**. Specifies the comment character. Lines beginning with the Comment character without preceding whitespace are ignored.

#### tags

Expand Down
2 changes: 2 additions & 0 deletions docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| client.address | The address of graph in NebulaGraph. | - |
| client.user | The user of NebulaGraph. | root |
| client.password | The password of NebulaGraph. | nebula |
| client.handshakeKey | The handshakeKey of NebulaGraph. | - |
| client.ssl | SSL related configuration. | nebula |
| client.ssl.enable | Specifies whether to enable ssl authentication. | false |
| client.ssl.certPath | Specifies the path of the certificate file. | - |
Expand Down Expand Up @@ -82,6 +83,7 @@
| sources[].csv.delimiter | Specifies the delimiter for the CSV files. | "," |
| sources[].csv.withHeader | Specifies whether to ignore the first record in csv file. | false |
| sources[].csv.lazyQuotes | Specifies lazy quotes of csv file. | false |
| sources[].csv.comment | Specifies the comment character. | - |
| sources[].tags | Describes the schema definition for tags. | - |
| sources[].tags[].name | The tag name. | - |
| sources[].tags[].mode | The mode for processing data, one of `INSERT`, `UPDATE` or `DELETE`. | - |
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ require (
github.com/spf13/afero v1.9.3
github.com/spf13/cobra v1.6.1
github.com/valyala/bytebufferpool v1.0.0
github.com/vesoft-inc/nebula-go/v3 v3.6.1
github.com/vesoft-inc/nebula-go/v3 v3.6.2-0.20240108060629-6eb07e9b9e0f
go.uber.org/zap v1.23.0
golang.org/x/crypto v0.17.0
golang.org/x/crypto v0.18.0
google.golang.org/api v0.114.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -60,9 +60,9 @@ require (
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
Expand Down
35 changes: 23 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/vesoft-inc/fbthrift v0.0.0-20230214024353-fa2f34755b28 h1:gpoPCGeOEuk/TnoY9nLVK1FoBM5ie7zY3BPVG8q43ME=
github.com/vesoft-inc/fbthrift v0.0.0-20230214024353-fa2f34755b28/go.mod h1:xu7e9za8StcJhBZmCDwK1Hyv4/Y0xFsjS+uqp10ECJg=
github.com/vesoft-inc/nebula-go/v3 v3.6.1 h1:RHdt8WC+jmrRqM9r9WWzz4tzM8VrykPHe9RhtLZjSVA=
github.com/vesoft-inc/nebula-go/v3 v3.6.1/go.mod h1:mjMPlpNKnHYhe1pWz4caT7x9R+wKoX7dIm6u1+Rdcws=
github.com/vesoft-inc/nebula-go/v3 v3.6.2-0.20240108060629-6eb07e9b9e0f h1:X5KvPu/W6sO5NvTocDLWgn9OCUwVx6PbY16PQoEvm7E=
github.com/vesoft-inc/nebula-go/v3 v3.6.2-0.20240108060629-6eb07e9b9e0f/go.mod h1:YTNAQzimjXLXUaEDOzty/eCCye+9zkZRuUzXz9LQUpU=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -288,8 +288,9 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -325,6 +326,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -361,9 +363,11 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -430,14 +434,18 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -447,7 +455,9 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -505,6 +515,7 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
9 changes: 8 additions & 1 deletion pkg/client/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type (
addresses []string
user string
password string
handshakeKey string
tlsConfig *tls.Config
retry int
retryInitialInterval time.Duration
Expand All @@ -48,7 +49,7 @@ type (
func WithV3() Option {
return func(o *options) {
WithNewSessionFunc(func(hostAddress HostAddress) Session {
return newSessionV3(hostAddress, o.user, o.password, o.tlsConfig.Clone(), o.logger)
return newSessionV3(hostAddress, o.user, o.password, o.handshakeKey, o.tlsConfig.Clone(), o.logger)
})(o)
}
}
Expand Down Expand Up @@ -84,6 +85,12 @@ func WithUserPassword(user, password string) Option {
}
}

func WithHandshakeKey(handshakeKey string) Option {
return func(o *options) {
o.handshakeKey = handshakeKey
}
}

func WithTLSConfig(tlsConfig *tls.Config) Option {
return func(o *options) {
o.tlsConfig = tlsConfig
Expand Down
6 changes: 6 additions & 0 deletions pkg/client/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var _ = Describe("Option", func() {
Expect(o.addresses).To(Equal([]string(nil)))
Expect(o.user).To(Equal(DefaultUser))
Expect(o.password).To(Equal(DefaultPassword))
Expect(o.handshakeKey).To(BeEmpty())
Expect(o.tlsConfig).To(BeNil())
Expect(o.retry).To(Equal(DefaultRetry))
Expect(o.retryInitialInterval).To(Equal(DefaultRetryInitialInterval))
Expand All @@ -32,6 +33,7 @@ var _ = Describe("Option", func() {
Expect(o1.addresses).To(Equal([]string(nil)))
Expect(o1.user).To(Equal(DefaultUser))
Expect(o1.password).To(Equal(DefaultPassword))
Expect(o.handshakeKey).To(BeEmpty())
Expect(o1.tlsConfig).To(BeNil())
Expect(o1.retry).To(Equal(DefaultRetry))
Expect(o1.retryInitialInterval).To(Equal(DefaultRetryInitialInterval))
Expand All @@ -57,6 +59,8 @@ var _ = Describe("Option", func() {
WithUser("u0"),
WithPassword("p0"),
WithUserPassword("newUser", "newPassword"),
WithHandshakeKey("handshakeKey"),
WithHandshakeKey("newHandshakeKey"),
WithTLSConfig(&tls.Config{}), //nolint:gosec
WithTLSConfig(&tls.Config{InsecureSkipVerify: true}), //nolint:gosec
WithRetry(DefaultRetry-1),
Expand Down Expand Up @@ -84,6 +88,7 @@ var _ = Describe("Option", func() {
}))
Expect(o.user).To(Equal("newUser"))
Expect(o.password).To(Equal("newPassword"))
Expect(o.handshakeKey).To(Equal("newHandshakeKey"))
Expect(o.tlsConfig).NotTo(BeNil())
Expect(o.tlsConfig.InsecureSkipVerify).To(BeTrue())
Expect(o.retry).To(Equal(DefaultRetry + 1))
Expand All @@ -108,6 +113,7 @@ var _ = Describe("Option", func() {
}))
Expect(o1.user).To(Equal("newUser"))
Expect(o1.password).To(Equal("newPassword"))
Expect(o.handshakeKey).To(Equal("newHandshakeKey"))
Expect(o1.tlsConfig).NotTo(BeNil())
Expect(o1.tlsConfig.InsecureSkipVerify).To(BeTrue())
Expect(o1.retry).To(Equal(DefaultRetry + 1))
Expand Down
26 changes: 15 additions & 11 deletions pkg/client/session_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ import (

type (
defaultSessionV3 struct {
session *nebula.Session
hostAddress nebula.HostAddress
user string
password string
tlsConfig *tls.Config
logger logger.Logger
session *nebula.Session
hostAddress nebula.HostAddress
user string
password string
handshakeKey string
tlsConfig *tls.Config
logger logger.Logger
}
)

func newSessionV3(hostAddress HostAddress, user, password string, tlsConfig *tls.Config, l logger.Logger) Session {
//revive:disable-next-line:argument-limit
func newSessionV3(hostAddress HostAddress, user, password, handshakeKey string, tlsConfig *tls.Config, l logger.Logger) Session {
if l == nil {
l = logger.NopLogger
}
Expand All @@ -30,10 +32,11 @@ func newSessionV3(hostAddress HostAddress, user, password string, tlsConfig *tls
Host: hostAddress.Host,
Port: hostAddress.Port,
},
user: user,
password: password,
tlsConfig: tlsConfig,
logger: l,
user: user,
password: password,
handshakeKey: handshakeKey,
tlsConfig: tlsConfig,
logger: l,
}
}

Expand All @@ -43,6 +46,7 @@ func (s *defaultSessionV3) Open() error {
[]nebula.HostAddress{hostAddress},
nebula.PoolConfig{
MaxConnPoolSize: 1,
HandshakeKey: s.handshakeKey,
},
s.tlsConfig,
newNebulaLogger(s.logger.With(logger.Field{
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/session_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var _ = Describe("SessionV3", func() {
It("success", func() {
session := newSessionV3(HostAddress{}, "user", "password", nil, nil)
session := newSessionV3(HostAddress{}, "user", "password", "", nil, nil)
pool := &nebula.ConnectionPool{}
nSession := &nebula.Session{}

Expand All @@ -39,7 +39,7 @@ var _ = Describe("SessionV3", func() {
})

It("failed", func() {
session := newSessionV3(HostAddress{}, "user", "password", nil, logger.NopLogger)
session := newSessionV3(HostAddress{}, "user", "password", "", nil, logger.NopLogger)
pool := &nebula.ConnectionPool{}
nSession := &nebula.Session{}

Expand Down
4 changes: 3 additions & 1 deletion pkg/config/base/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type (
Address string `yaml:"address"`
User string `yaml:"user,omitempty"`
Password string `yaml:"password,omitempty"`
HandshakeKey string `yaml:"handshakeKey,omitempty"`
ConcurrencyPerAddress int `yaml:"concurrencyPerAddress,omitempty"`
ReconnectInitialInterval time.Duration `yaml:"reconnectInitialInterval,omitempty"`
Retry int `yaml:"retry,omitempty"`
Expand Down Expand Up @@ -66,11 +67,12 @@ func (c *Client) BuildClientPool(opts ...client.Option) (client.Pool, error) {
return nil, err
}

options := make([]client.Option, 0, 8+len(opts))
options := make([]client.Option, 0, 9+len(opts))
options = append(
options,
client.WithAddress(c.Address),
client.WithUserPassword(c.User, c.Password),
client.WithHandshakeKey(c.HandshakeKey),
client.WithTLSConfig(tlsConfig),
client.WithReconnectInitialInterval(c.ReconnectInitialInterval),
client.WithRetry(c.Retry),
Expand Down

0 comments on commit ac556b5

Please sign in to comment.