Skip to content

Commit 066ea8b

Browse files
alexandrosfiliosadecaro
authored andcommitted
Fix parsing of [::1] address and chaincode endpoint
Signed-off-by: Alexandros Filios <alexandros.filios@ibm.com>
1 parent 242d866 commit 066ea8b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

integration/nwo/fabric/topology/core_template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ peer:
1717
address: {{ .PeerAddress Peer "Listen" }}
1818
addressAutoDetect: true
1919
listenAddress: 0.0.0.0:{{ .PeerPort Peer "Listen" }}
20-
chaincodeListenAddress: {{ if gt (.PeerPort Peer "Chaincode") 0 }}{{ .PeerAddress Peer "Chaincode" }}{{ end }}
20+
chaincodeListenAddress: {{ if gt (.PeerPort Peer "Chaincode") 0 }}0.0.0.0:{{ .PeerPort Peer "Chaincode" }}{{ end }}
2121
keepalive:
2222
minInterval: 60s
2323
interval: 300s

platform/view/services/comm/endpoint.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import (
1616

1717
func AddressToEndpoint(endpoint string) (string, error) {
1818
s := strings.Split(endpoint, ":")
19+
if len(s) > 2 {
20+
if host := strings.Join(s[:len(s)-1], ":"); host == "[::1]" {
21+
s = []string{"0.0.0.0", s[len(s)-1]}
22+
}
23+
}
1924
if len(s) != 2 {
2025
return "", errors.Errorf("invalid endpoint [%s], expected 2 components, got [%d]", endpoint, len(s))
2126
}

0 commit comments

Comments
 (0)