Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChristopheSchmitz/5022edb008d78a45b994da5a0e93d76e to your computer and use it in GitHub Desktop.
Save ChristopheSchmitz/5022edb008d78a45b994da5a0e93d76e to your computer and use it in GitHub Desktop.
sample-CassandraDriverAddressTranslater gist 3
static class PrivateToPublicAddressTranslater implements AddressTranslater {
final HashMap<InetSocketAddress, InetSocketAddress> privatePublicAddressMap = new HashMap<InetSocketAddress, InetSocketAddress>();
{
privatePublicAddressMap.put(new InetSocketAddress("10.224.0.134", 9042), new InetSocketAddress("50.16.170.131", 9042));
privatePublicAddressMap.put(new InetSocketAddress("10.224.89.62", 9042), new InetSocketAddress("52.202.55.67", 9042));
privatePublicAddressMap.put(new InetSocketAddress("10.224.133.143", 9042), new InetSocketAddress("52.202.11.232", 9042));
}
public InetSocketAddress translate(final InetSocketAddress inetSocketAddress) {
return privatePublicAddressMap.get(inetSocketAddress);
}
}
@ChristopheSchmitz
Copy link
Author

Gist used for blogpost on how to use AddressTranslater

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment