@@ -22,7 +22,7 @@ type connector struct {
2222 encodedAttributes string // Encoded connection attributes.
2323}
2424
25- func encodeConnectionAttributes (textAttributes string ) string {
25+ func encodeConnectionAttributes (cfg * Config ) string {
2626 connAttrsBuf := make ([]byte , 0 )
2727
2828 // default connection attributes
@@ -34,9 +34,12 @@ func encodeConnectionAttributes(textAttributes string) string {
3434 connAttrsBuf = appendLengthEncodedString (connAttrsBuf , connAttrPlatformValue )
3535 connAttrsBuf = appendLengthEncodedString (connAttrsBuf , connAttrPid )
3636 connAttrsBuf = appendLengthEncodedString (connAttrsBuf , strconv .Itoa (os .Getpid ()))
37+ connAttrsBuf = appendLengthEncodedString (connAttrsBuf , connAttrServerHost )
38+ serverHost , _ , _ := net .SplitHostPort (cfg .Addr )
39+ connAttrsBuf = appendLengthEncodedString (connAttrsBuf , serverHost )
3740
3841 // user-defined connection attributes
39- for _ , connAttr := range strings .Split (textAttributes , "," ) {
42+ for _ , connAttr := range strings .Split (cfg . ConnectionAttributes , "," ) {
4043 k , v , found := strings .Cut (connAttr , ":" )
4144 if ! found {
4245 continue
@@ -49,7 +52,7 @@ func encodeConnectionAttributes(textAttributes string) string {
4952}
5053
5154func newConnector (cfg * Config ) * connector {
52- encodedAttributes := encodeConnectionAttributes (cfg . ConnectionAttributes )
55+ encodedAttributes := encodeConnectionAttributes (cfg )
5356 return & connector {
5457 cfg : cfg ,
5558 encodedAttributes : encodedAttributes ,
0 commit comments