cmd/connector-gen: add helper tool for wide app connector configurations

connector-gen can initially generate connector ACL snippets and
advertise-routes flags for Github and AWS based on their public IP /
domain data.

Updates ENG-2425
Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
James Tucker
2023-12-14 17:20:32 -08:00
committed by James Tucker
parent 706e30d49e
commit 3a635db06e
5 changed files with 255 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package main
import (
"fmt"
"strings"
"go4.org/netipx"
)
func advertiseRoutes(set *netipx.IPSet) {
fmt.Println()
prefixes := set.Prefixes()
pfxs := make([]string, 0, len(prefixes))
for _, pfx := range prefixes {
pfxs = append(pfxs, pfx.String())
}
fmt.Printf("--advertise-routes=%s", strings.Join(pfxs, ","))
fmt.Println()
}