In theory, that could be done with a PAC file. Unfortunately, KM's PAC file support is glitchy and just flubbs out when you try to use a whitelist. You could achieve that effect with a firewall or proxy, I don't know if it would be possible to make some sort of macro to do it though.