Created
July 7, 2015 15:26
-
-
Save hbasria/f9209ae98e80c0975bee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION is_private_ip(p_prefix inet) RETURNS boolean AS | |
$BODY$ | |
BEGIN | |
RETURN ( | |
SELECT | |
CASE | |
WHEN '10.0.0.0/8'::inet >> p_prefix::inet | |
OR '192.168.0.0/16'::inet >> p_prefix::inet | |
OR '172.16.0.0/12'::inet >> p_prefix::inet THEN True | |
ELSE False | |
END); | |
END; | |
$BODY$ | |
LANGUAGE plpgsql VOLATILE | |
COST 100; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment