utils

package
v0.0.0-...-d5ede11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GeoIPUnknown is returned when the city or country name can't be resolved.
	GeoIPUnknown = "<unknown>"
)

Functions

func FindUserHome

func FindUserHome() string

FindUserHome returns the home directory of the current user.

func FormatIPAndLocation

func FormatIPAndLocation(ip string) string

FormatIPAndLocation returns the ip with geo location for the given ip.

func IsInteractiveConnection

func IsInteractiveConnection() bool

IsInteractiveConnection returns true if the terminal is interactive

func ParseGitCommand

func ParseGitCommand(command string) (typ string, repo string)

ParseGitCommand rturns the type of the operation and the repo given a git command

func PrintMessage

func PrintMessage(message string, args ...interface{})

PrintMessage prints a message only if the terminal is interactive, otherwise the message is ignored.

func PublicKeyFingerprint

func PublicKeyFingerprint(pubkey string) (string, string)

PublicKeyFingerprint Helper function to get the fingerprint of a SSH public key

func Rfc4716Hex

func Rfc4716Hex(data []byte) string

Rfc4716Hex returns the data in hex format separated by ":"

func RunCommand

func RunCommand(command ...string) string

RunCommand runns the given command and arguments

func RunShell

func RunShell()

RunShell runs the shell indicated in the $SHELL env var

func RunShellFromPath

func RunShellFromPath(shellPath string)

RunShellFromPath runs a given shell

func RunShellFromPathWithArgs

func RunShellFromPathWithArgs(shellPath string, shellArgs []string)

RunShellFromPathWithArgs runs a shell given the given arguments

Types

type GeoIP

type GeoIP struct {
	// contains filtered or unexported fields
}

GeoIP contains information about the geolocalization.

func NewGeoIP

func NewGeoIP(ip string) (*GeoIP, error)

NewGeoIP returns a new instance of the Geoip struct

func (*GeoIP) City

func (geoip *GeoIP) City() string

City returns the name of the city

func (*GeoIP) Country

func (geoip *GeoIP) Country() string

Country returns the name of the country

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL