Buckets:
| import { isPrivateIp } from './is-private-ip' | |
| describe('isPrivateIp', () => { | |
| it('should return true for private ip addresses', () => { | |
| expect(isPrivateIp('127.0.0.0')).toBe(true) | |
| expect(isPrivateIp('127.0.0.1')).toBe(true) | |
| expect(isPrivateIp('127.0.0.01')).toBe(true) | |
| expect(isPrivateIp('127.0.0.001')).toBe(true) | |
| expect(isPrivateIp('0.0.0.0')).toBe(true) | |
| expect(isPrivateIp('10.0.0.0')).toBe(true) | |
| expect(isPrivateIp('10.244.0.0')).toBe(true) | |
| expect(isPrivateIp('192.168.0.0')).toBe(true) | |
| expect(isPrivateIp('192.168.0.1')).toBe(true) | |
| expect(isPrivateIp('192.168.0.01')).toBe(true) | |
| expect(isPrivateIp('172.16.0.0')).toBe(true) | |
| expect(isPrivateIp('172.16.0.1')).toBe(true) | |
| expect(isPrivateIp('172.16.0.01')).toBe(true) | |
| expect(isPrivateIp('192.168.0.1')).toBe(true) | |
| expect(isPrivateIp('192.168.0.01')).toBe(true) | |
| expect(isPrivateIp('169.254.169.254')).toBe(true) | |
| expect(isPrivateIp('::')).toBe(true) | |
| expect(isPrivateIp('::1')).toBe(true) | |
| expect(isPrivateIp('::ffff:0.0.0.0')).toBe(true) | |
| expect(isPrivateIp('::ffff:127.0.0.1')).toBe(true) | |
| expect(isPrivateIp('::ffff:7f00:1')).toBe(true) | |
| expect(isPrivateIp(new URL('http://0x7f000001').hostname)).toBe(true) | |
| expect(isPrivateIp('2001:2f:ffff:ffff:ffff:ffff:ffff:ffff')).toBe(true) | |
| expect(isPrivateIp('[2001:2f:ffff:ffff:ffff:ffff:ffff:ffff]')).toBe(true) | |
| expect(isPrivateIp('2002::')).toBe(true) | |
| expect(isPrivateIp('ff00::')).toBe(true) | |
| }) | |
| it('should return false for public ip addresses', () => { | |
| expect(isPrivateIp('76.76.21.21')).toBe(false) | |
| expect(isPrivateIp('157.240.14.35')).toBe(false) | |
| expect(isPrivateIp('8.8.8.8')).toBe(false) | |
| expect(isPrivateIp('1.1.1.1')).toBe(false) | |
| expect(isPrivateIp('::ffff:8.8.8.8')).toBe(false) | |
| expect(isPrivateIp('::ffff:1.1.1.1')).toBe(false) | |
| expect(isPrivateIp('2001:4860:4860::8888')).toBe(false) | |
| expect(isPrivateIp('2606:4700:4700::1111')).toBe(false) | |
| }) | |
| it('should return false for domains', () => { | |
| expect(isPrivateIp('vercel.com')).toBe(false) | |
| expect(isPrivateIp('www.vercel.com')).toBe(false) | |
| expect(isPrivateIp('nextjs.org')).toBe(false) | |
| expect(isPrivateIp('docs.nextjs.org')).toBe(false) | |
| }) | |
| }) | |
Xet Storage Details
- Size:
- 2.25 kB
- Xet hash:
- 2ddb5ea4ac8998568ef5a062a35cbae274335679f4dc7a5f723eb90ecd6037ee
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.