-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssrf_gen.go
74 lines (67 loc) · 3.86 KB
/
ssrf_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// MIT License
//
// Copyright (c) 2022 Daniele Sluijters
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// WARNING: This file is generated by ssrfgen. DO NOT EDIT.
package ssrf
import (
"net/netip"
)
var (
// IPv4DeniedPrefixes contains IPv4 special purpose IP prefixes from IANA
// as well as a number of other prefixes we wish to block by default
// https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
IPv4DeniedPrefixes = []netip.Prefix{
netip.MustParsePrefix("0.0.0.0/8"), // "This network" (RFC 791, Section 3.2)
netip.MustParsePrefix("10.0.0.0/8"), // Private-Use (RFC 1918)
netip.MustParsePrefix("100.64.0.0/10"), // Shared Address Space (RFC 6598)
netip.MustParsePrefix("127.0.0.0/8"), // Loopback (RFC 1122, Section 3.2.1.3)
netip.MustParsePrefix("169.254.0.0/16"), // Link Local (RFC 3927)
netip.MustParsePrefix("172.16.0.0/12"), // Private-Use (RFC 1918)
netip.MustParsePrefix("192.0.0.0/24"), // IETF Protocol Assignments (RFC 6890, Section 2.1)
netip.MustParsePrefix("192.0.2.0/24"), // Documentation (TEST-NET-1) (RFC 5737)
netip.MustParsePrefix("192.31.196.0/24"), // AS112-v4 (RFC 7535)
netip.MustParsePrefix("192.52.193.0/24"), // AMT (RFC 7450)
netip.MustParsePrefix("192.88.99.0/24"), // Deprecated (6to4 Relay Anycast) (RFC 7526)
netip.MustParsePrefix("192.168.0.0/16"), // Private-Use (RFC 1918)
netip.MustParsePrefix("192.175.48.0/24"), // Direct Delegation AS112 Service (RFC 7534)
netip.MustParsePrefix("198.18.0.0/15"), // Benchmarking (RFC 2544)
netip.MustParsePrefix("198.51.100.0/24"), // Documentation (TEST-NET-2) (RFC 5737)
netip.MustParsePrefix("203.0.113.0/24"), // Documentation (TEST-NET-3) (RFC 5737)
netip.MustParsePrefix("240.0.0.0/4"), // Reserved (RFC 1112, Section 4)
netip.MustParsePrefix("224.0.0.0/4"), // Multicast (RFC 1112, Section 4)
}
// IPv6GlobalUnicast is the prefix set aside by IANA for global unicast
// assignments, i.e "the internet"
IPv6GlobalUnicast = netip.MustParsePrefix("2000::/3")
// IPv6NAT64Prefix is the prefix set aside for NAT64. This allows a server
// to only have an IPv6 address but still be able to talk to an IPv4-only
// server through DNS64+NAT64
IPv6NAT64Prefix = netip.MustParsePrefix("64:ff9b::/96")
// IPv6DeniedPrefixes contains IPv6 special purpose IP prefixes from IANA
// within the IPv6 Global Unicast range that we wish to block by default
// https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
IPv6DeniedPrefixes = []netip.Prefix{
netip.MustParsePrefix("2001::/23"), // IETF Protocol Assignments (RFC 2928)
netip.MustParsePrefix("2001:db8::/32"), // Documentation (RFC 3849)
netip.MustParsePrefix("2002::/16"), // 6to4 (RFC 3056)
netip.MustParsePrefix("2620:4f:8000::/48"), // Direct Delegation AS112 Service (RFC 7534)
}
)