Compare commits
1 Commits
main
...
catzkorn/j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3ad2806b8 |
92
cmd/connector-gen/atlasian.go
Normal file
92
cmd/connector-gen/atlasian.go
Normal file
@@ -0,0 +1,92 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/netip"
|
||||
|
||||
"go4.org/netipx"
|
||||
)
|
||||
|
||||
// See https://ip-ranges.atlassian.com/
|
||||
type AtlassianMeta struct {
|
||||
CreationDate string `json:"creationDate"`
|
||||
SyncToken int `json:"syncToken"`
|
||||
Items []struct {
|
||||
Network string `json:"network"`
|
||||
MaskLen int `json:"mask_len"`
|
||||
Cidr string `json:"cidr"`
|
||||
Mask string `json:"mask"`
|
||||
Region []string `json:"region"`
|
||||
Product []string `json:"product"`
|
||||
Direction []string `json:"direction"`
|
||||
Perimeter string `json:"perimeter"`
|
||||
} `json:"items"`
|
||||
}
|
||||
|
||||
func jira() {
|
||||
parseAtlassian("jira")
|
||||
}
|
||||
|
||||
func confluence() {
|
||||
parseAtlassian("confluence")
|
||||
}
|
||||
|
||||
func parseAtlassian(productName string) {
|
||||
r, err := http.Get("https://ip-ranges.atlassian.com/")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var meta AtlassianMeta
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&meta); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
r.Body.Close()
|
||||
|
||||
var ips netipx.IPSetBuilder
|
||||
for _, item := range meta.Items {
|
||||
isProductName := false
|
||||
isIngress := false
|
||||
|
||||
for _, direction := range item.Direction {
|
||||
if direction != "ingress" {
|
||||
// For routes, we are only interested in
|
||||
// ingress routes. Skip over any that aren't
|
||||
// marked as such.
|
||||
continue
|
||||
}
|
||||
isIngress = true
|
||||
break
|
||||
}
|
||||
|
||||
for _, product := range item.Product {
|
||||
if product != productName {
|
||||
continue
|
||||
}
|
||||
isProductName = true
|
||||
break
|
||||
}
|
||||
|
||||
if !isProductName || !isIngress {
|
||||
continue
|
||||
}
|
||||
|
||||
ips.AddPrefix(netip.MustParsePrefix(item.Cidr))
|
||||
}
|
||||
|
||||
set, err := ips.IPSet()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, addr := range set.Prefixes() {
|
||||
fmt.Println(fmt.Sprintf(`"%s",`, addr))
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,14 @@ func main() {
|
||||
github()
|
||||
case "aws":
|
||||
aws()
|
||||
case "jira":
|
||||
jira()
|
||||
case "confluence":
|
||||
confluence()
|
||||
case "workspace":
|
||||
workspace()
|
||||
case "stripe":
|
||||
stripe()
|
||||
default:
|
||||
help()
|
||||
os.Exit(128)
|
||||
|
||||
55
cmd/connector-gen/google-workspace.go
Normal file
55
cmd/connector-gen/google-workspace.go
Normal file
@@ -0,0 +1,55 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// See https://www.gstatic.com/ipranges/goog.json
|
||||
|
||||
type Workspace struct {
|
||||
SyncToken string `json:"syncToken"`
|
||||
CreationTime string `json:"creationTime"`
|
||||
Prefixes []struct {
|
||||
Ipv4Prefix string `json:"ipv4Prefix,omitempty"`
|
||||
Ipv6Prefix string `json:"ipv6Prefix,omitempty"`
|
||||
} `json:"prefixes"`
|
||||
}
|
||||
|
||||
func workspace() {
|
||||
r, err := http.Get("https://www.gstatic.com/ipranges/goog.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var workspaceAddresses Workspace
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&workspaceAddresses); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
r.Body.Close()
|
||||
|
||||
var v4 []string
|
||||
var v6 []string
|
||||
for _, item := range workspaceAddresses.Prefixes {
|
||||
if item.Ipv4Prefix != "" {
|
||||
v4 = append(v4, item.Ipv4Prefix)
|
||||
}
|
||||
|
||||
if item.Ipv6Prefix != "" {
|
||||
v6 = append(v6, item.Ipv6Prefix)
|
||||
}
|
||||
}
|
||||
|
||||
for _, addr := range v4 {
|
||||
fmt.Println(fmt.Sprintf(`"%s",`, addr))
|
||||
}
|
||||
for _, addr := range v6 {
|
||||
fmt.Println(fmt.Sprintf(`"%s",`, addr))
|
||||
}
|
||||
}
|
||||
249
cmd/connector-gen/stripe.go
Normal file
249
cmd/connector-gen/stripe.go
Normal file
@@ -0,0 +1,249 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/netip"
|
||||
"strings"
|
||||
|
||||
"go4.org/netipx"
|
||||
)
|
||||
|
||||
var (
|
||||
stripeRoutes = []string{
|
||||
"13.112.224.240",
|
||||
"13.115.13.148",
|
||||
"13.210.129.177",
|
||||
"13.210.176.167",
|
||||
"13.228.126.182",
|
||||
"13.228.224.121",
|
||||
"13.230.11.13",
|
||||
"13.230.90.110",
|
||||
"13.55.153.188",
|
||||
"13.55.5.15",
|
||||
"13.56.126.253",
|
||||
"13.56.173.200",
|
||||
"13.56.173.232",
|
||||
"13.57.108.134",
|
||||
"13.57.155.157",
|
||||
"13.57.156.206",
|
||||
"13.57.157.116",
|
||||
"13.57.90.254",
|
||||
"13.57.98.27",
|
||||
"18.194.147.12",
|
||||
"18.195.120.229",
|
||||
"18.195.125.165",
|
||||
"34.200.27.109",
|
||||
"34.200.47.89",
|
||||
"34.202.153.183",
|
||||
"34.204.109.15",
|
||||
"34.213.149.138",
|
||||
"34.214.229.69",
|
||||
"34.223.201.215",
|
||||
"34.237.201.68",
|
||||
"34.237.253.141",
|
||||
"34.238.187.115",
|
||||
"34.239.14.72",
|
||||
"34.240.123.193",
|
||||
"34.241.202.139",
|
||||
"34.241.54.72",
|
||||
"34.241.59.225",
|
||||
"34.250.29.31",
|
||||
"34.250.89.120",
|
||||
"35.156.131.6",
|
||||
"35.156.194.238",
|
||||
"35.157.227.67",
|
||||
"35.158.254.198",
|
||||
"35.163.82.19",
|
||||
"35.164.105.206",
|
||||
"35.164.124.216",
|
||||
"50.16.2.231",
|
||||
"50.18.212.157",
|
||||
"50.18.212.223",
|
||||
"50.18.219.232",
|
||||
"52.1.23.197",
|
||||
"52.196.53.105",
|
||||
"52.196.95.231",
|
||||
"52.204.6.233",
|
||||
"52.205.132.193",
|
||||
"52.211.198.11",
|
||||
"52.212.99.37",
|
||||
"52.213.35.125",
|
||||
"52.22.83.139",
|
||||
"52.220.44.249",
|
||||
"52.25.214.31",
|
||||
"52.26.11.205",
|
||||
"52.26.132.102",
|
||||
"52.26.14.11",
|
||||
"52.36.167.221",
|
||||
"52.53.133.6",
|
||||
"52.54.150.82",
|
||||
"52.57.221.37",
|
||||
"52.59.173.230",
|
||||
"52.62.14.35",
|
||||
"52.62.203.73",
|
||||
"52.63.106.9",
|
||||
"52.63.119.77",
|
||||
"52.65.161.237",
|
||||
"52.73.161.98",
|
||||
"52.74.114.251",
|
||||
"52.74.98.83",
|
||||
"52.76.14.176",
|
||||
"52.76.156.251",
|
||||
"52.76.174.156",
|
||||
"52.77.80.43",
|
||||
"52.8.19.58",
|
||||
"52.8.8.189",
|
||||
"54.149.153.72",
|
||||
"54.152.36.104",
|
||||
"54.183.95.195",
|
||||
"54.187.182.230",
|
||||
"54.187.199.38",
|
||||
"54.187.208.163",
|
||||
"54.238.140.239",
|
||||
"54.65.115.204",
|
||||
"54.65.97.98",
|
||||
"54.67.48.128",
|
||||
"54.67.52.245",
|
||||
"54.68.165.206",
|
||||
"54.68.183.151",
|
||||
"107.23.48.182",
|
||||
"107.23.48.232",
|
||||
"198.137.150.21",
|
||||
"198.137.150.22",
|
||||
"198.137.150.23",
|
||||
"198.137.150.24",
|
||||
"198.137.150.25",
|
||||
"198.137.150.26",
|
||||
"198.137.150.27",
|
||||
"198.137.150.28",
|
||||
"198.137.150.101",
|
||||
"198.137.150.102",
|
||||
"198.137.150.103",
|
||||
"198.137.150.104",
|
||||
"198.137.150.105",
|
||||
"198.137.150.106",
|
||||
"198.137.150.107",
|
||||
"198.137.150.108",
|
||||
"198.137.150.171",
|
||||
"198.137.150.172",
|
||||
"198.137.150.173",
|
||||
"198.137.150.174",
|
||||
"198.137.150.175",
|
||||
"198.137.150.176",
|
||||
"198.137.150.177",
|
||||
"198.137.150.178",
|
||||
"198.137.150.221",
|
||||
"198.137.150.222",
|
||||
"198.137.150.223",
|
||||
"198.137.150.224",
|
||||
"198.137.150.225",
|
||||
"198.137.150.226",
|
||||
"198.137.150.227",
|
||||
"198.137.150.228",
|
||||
"198.202.176.21",
|
||||
"198.202.176.22",
|
||||
"198.202.176.23",
|
||||
"198.202.176.24",
|
||||
"198.202.176.25",
|
||||
"198.202.176.26",
|
||||
"198.202.176.27",
|
||||
"198.202.176.28",
|
||||
"198.202.176.101",
|
||||
"198.202.176.102",
|
||||
"198.202.176.103",
|
||||
"198.202.176.104",
|
||||
"198.202.176.105",
|
||||
"198.202.176.106",
|
||||
"198.202.176.107",
|
||||
"198.202.176.108",
|
||||
"198.202.176.171",
|
||||
"198.202.176.172",
|
||||
"198.202.176.173",
|
||||
"198.202.176.174",
|
||||
"198.202.176.175",
|
||||
"198.202.176.176",
|
||||
"198.202.176.177",
|
||||
"198.202.176.178",
|
||||
"198.202.176.221",
|
||||
"198.202.176.222",
|
||||
"198.202.176.223",
|
||||
"198.202.176.224",
|
||||
"198.202.176.225",
|
||||
"198.202.176.226",
|
||||
"198.202.176.227",
|
||||
"198.202.176.228",
|
||||
"3.94.14.82",
|
||||
"3.104.99.60",
|
||||
"3.114.81.222",
|
||||
"3.114.158.108",
|
||||
"3.224.33.77",
|
||||
"13.113.237.213",
|
||||
"13.115.27.220",
|
||||
"13.228.40.76",
|
||||
"13.236.164.101",
|
||||
"18.136.179.41",
|
||||
"18.138.166.37",
|
||||
"18.141.119.41",
|
||||
"18.180.10.245",
|
||||
"23.22.133.111",
|
||||
"34.233.255.214",
|
||||
"34.247.101.32",
|
||||
"35.72.84.177",
|
||||
"44.235.152.108",
|
||||
"44.236.89.158",
|
||||
"44.240.26.72",
|
||||
"50.19.26.15",
|
||||
"52.64.98.19",
|
||||
"52.64.208.186",
|
||||
"52.210.46.219",
|
||||
"54.66.89.9",
|
||||
"54.151.226.211",
|
||||
"54.163.195.10",
|
||||
"54.169.250.228",
|
||||
"54.170.183.1",
|
||||
"54.187.175.68",
|
||||
"54.191.201.88",
|
||||
"54.194.97.239",
|
||||
"54.203.175.79",
|
||||
"54.206.239.65",
|
||||
"54.228.85.11",
|
||||
"176.34.78.115",
|
||||
"198.137.150.0/24",
|
||||
"198.202.176.0/24",
|
||||
"3.18.12.63",
|
||||
"3.130.192.231",
|
||||
"13.235.14.237",
|
||||
"13.235.122.149",
|
||||
"18.211.135.69",
|
||||
"35.154.171.200",
|
||||
"52.15.183.38",
|
||||
"54.88.130.119",
|
||||
"54.88.130.237",
|
||||
"54.187.174.169",
|
||||
"54.187.205.235",
|
||||
"54.187.216.72",
|
||||
}
|
||||
)
|
||||
|
||||
func stripe() {
|
||||
var ips netipx.IPSetBuilder
|
||||
for _, route := range stripeRoutes {
|
||||
if strings.Contains(route, "/") {
|
||||
ips.AddPrefix(netip.MustParsePrefix(route))
|
||||
continue
|
||||
}
|
||||
|
||||
ips.Add((netip.MustParseAddr(route)))
|
||||
}
|
||||
|
||||
set, err := ips.IPSet()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, addr := range set.Prefixes() {
|
||||
fmt.Println(fmt.Sprintf(`"%s",`, addr))
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user