@@ -22,7 +22,7 @@ type connector struct {
22
22
encodedAttributes string // Encoded connection attributes.
23
23
}
24
24
25
- func encodeConnectionAttributes (textAttributes string ) string {
25
+ func encodeConnectionAttributes (cfg * Config ) string {
26
26
connAttrsBuf := make ([]byte , 0 )
27
27
28
28
// default connection attributes
@@ -34,9 +34,12 @@ func encodeConnectionAttributes(textAttributes string) string {
34
34
connAttrsBuf = appendLengthEncodedString (connAttrsBuf , connAttrPlatformValue )
35
35
connAttrsBuf = appendLengthEncodedString (connAttrsBuf , connAttrPid )
36
36
connAttrsBuf = appendLengthEncodedString (connAttrsBuf , strconv .Itoa (os .Getpid ()))
37
+ connAttrsBuf = appendLengthEncodedString (connAttrsBuf , connAttrServerHost )
38
+ serverHost , _ , _ := net .SplitHostPort (cfg .Addr )
39
+ connAttrsBuf = appendLengthEncodedString (connAttrsBuf , serverHost )
37
40
38
41
// user-defined connection attributes
39
- for _ , connAttr := range strings .Split (textAttributes , "," ) {
42
+ for _ , connAttr := range strings .Split (cfg . ConnectionAttributes , "," ) {
40
43
k , v , found := strings .Cut (connAttr , ":" )
41
44
if ! found {
42
45
continue
@@ -49,7 +52,7 @@ func encodeConnectionAttributes(textAttributes string) string {
49
52
}
50
53
51
54
func newConnector (cfg * Config ) * connector {
52
- encodedAttributes := encodeConnectionAttributes (cfg . ConnectionAttributes )
55
+ encodedAttributes := encodeConnectionAttributes (cfg )
53
56
return & connector {
54
57
cfg : cfg ,
55
58
encodedAttributes : encodedAttributes ,
0 commit comments