Documentation ¶
Index ¶
- Constants
- func CaptureInputFromEditor(data []byte) ([]byte, error)
- func DefaultGateway(ip net.IP) net.IP
- func ExtractAddressFromReverse(reverseName string) string
- func GenerateSecret(n int) (string, error)
- func GetFirstExternalIPFromInterfaces() (net.IP, error)
- func GetInterfaceFromIP(ip net.IP) (string, net.IPMask, error)
- func GetInterfaceIPMap() (map[int]net.IP, error)
- func GetPreferredEditorFromEnvironment() string
- func IsReverse(name string) int
- func Normalize(name string) string
- func OpenFileInEditor(filename string) error
- type PreferredEditorResolver
Constants ¶
const ( // IP4arpa is the reverse tree suffix for v4 IP addresses. IP4arpa = ".in-addr.arpa." // IP6arpa is the reverse tree suffix for v6 IP addresses. IP6arpa = ".ip6.arpa." )
const DefaultEditor = "vim"
DefaultEditor is vim because we're adults ;)
Variables ¶
This section is empty.
Functions ¶
func CaptureInputFromEditor ¶
CaptureInputFromEditor opens a temporary file with data in a text editor and returns the written bytes on success or an error on failure. It handles deletion of the temporary file behind the scenes.
func ExtractAddressFromReverse ¶
ExtractAddressFromReverse turns a standard PTR reverse record name into an IP address. This works for ipv4 or ipv6.
54.119.58.176.in-addr.arpa. becomes 176.58.119.54. If the conversion fails the empty string is returned.
func GenerateSecret ¶
func GetPreferredEditorFromEnvironment ¶
func GetPreferredEditorFromEnvironment() string
GetPreferredEditorFromEnvironment returns the user's editor as defined by the `$EDITOR` environment variable, or the `DefaultEditor` if it is not set.
func IsReverse ¶
IsReverse returns 0 is name is not in a reverse zone. Anything > 0 indicates name is in a reverse zone. The returned integer will be 1 for in-addr.arpa. (IPv4) and 2 for ip6.arpa. (IPv6).
func OpenFileInEditor ¶
OpenFileInEditor opens filename in a text editor.
Types ¶
type PreferredEditorResolver ¶
type PreferredEditorResolver func() string
PreferredEditorResolver is a function that returns an editor that the user prefers to use, such as the configured `$EDITOR` environment variable.