You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Fix CLUSTER_NODES ipv6 address parsing (#2269)
This commit is contained in:
@@ -73,6 +73,31 @@ describe('CLUSTER NODES', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should support ipv6 addresses', () => {
|
||||
assert.deepEqual(
|
||||
transformReply(
|
||||
'id 2a02:6b8:c21:330d:0:1589:ebbe:b1a0:6379@16379 master - 0 0 0 connected 0-549\n'
|
||||
),
|
||||
[{
|
||||
id: 'id',
|
||||
address: '2a02:6b8:c21:330d:0:1589:ebbe:b1a0:6379@16379',
|
||||
host: '2a02:6b8:c21:330d:0:1589:ebbe:b1a0',
|
||||
port: 6379,
|
||||
cport: 16379,
|
||||
flags: ['master'],
|
||||
pingSent: 0,
|
||||
pongRecv: 0,
|
||||
configEpoch: 0,
|
||||
linkState: RedisClusterNodeLinkStates.CONNECTED,
|
||||
slots: [{
|
||||
from: 0,
|
||||
to: 549
|
||||
}],
|
||||
replicas: []
|
||||
}]
|
||||
);
|
||||
});
|
||||
|
||||
it.skip('with importing slots', () => {
|
||||
assert.deepEqual(
|
||||
transformReply(
|
||||
|
@@ -85,7 +85,7 @@ export function transformReply(reply: string): Array<RedisClusterMasterNode> {
|
||||
}
|
||||
|
||||
function transformNodeAddress(address: string): RedisClusterNodeAddress {
|
||||
const indexOfColon = address.indexOf(':'),
|
||||
const indexOfColon = address.lastIndexOf(':'),
|
||||
indexOfAt = address.indexOf('@', indexOfColon),
|
||||
host = address.substring(0, indexOfColon);
|
||||
|
||||
|
Reference in New Issue
Block a user