Skip to content

Commit 9c68a28

Browse files
committed
Add full IPv6 redis connection capability in a full IPv6 network or in a mix network (IPv4 and IPv6)
1 parent c68b3f7 commit 9c68a28

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ limits total time for client to reconnect. Value is provided in milliseconds and
210210
* `max_attempts` defaults to `null`. By default client will try reconnecting until connected. Setting `max_attempts`
211211
limits total amount of reconnects.
212212
* `auth_pass` defaults to `null`. By default client will try connecting without auth. If set, client will run redis auth command on connect.
213+
* `family` defaults to `IPv4`. By default client will try connecting with a IPv4 DNS resolution when a FQDN host is set. You can also specify and IPv6 for forcing a IPv6 FQDN resolution.
213214

214215
```js
215216
var redis = require("redis"),

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
## v0.10.4 - Jun 23, 2014
5+
6+
* Add redis-cli createClient(port, host, options) full IPv6 Network capability
7+
Specify the family type IPv4 or IPv6 in the options object.
8+
9+
eg: { 'family' : 'IPv6' }
10+
411
## v0.10.3 - May 22, 2014
512

613
* Update command list to match Redis 2.8.9 (Charles Feng)

index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,16 +1182,21 @@ RedisClient.prototype.eval = RedisClient.prototype.EVAL = function () {
11821182

11831183

11841184
exports.createClient = function (port_arg, host_arg, options) {
1185-
var port = port_arg || default_port,
1186-
host = host_arg || default_host,
1187-
redis_client, net_client;
11881185

1189-
net_client = net.createConnection(port, host);
1186+
var cnxOptions = {
1187+
'port' : port_arg || default_port,
1188+
'host' : host_arg || default_host,
1189+
'family' : options.family || 'IPv4'
1190+
};
1191+
1192+
var redis_client, net_client;
1193+
1194+
net_client = net.createConnection(cnxOptions);
11901195

11911196
redis_client = new RedisClient(net_client, options);
11921197

1193-
redis_client.port = port;
1194-
redis_client.host = host;
1198+
redis_client.port = cnxOptions.port;
1199+
redis_client.host = cnxOptions.host;
11951200

11961201
return redis_client;
11971202
};

0 commit comments

Comments
 (0)