utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2014 License: Apache-2.0, BSD-3-Clause, Zlib Imports: 10 Imported by: 3

Documentation

Overview

Package utils is for various "other" functions that things in Flitter use that may be useful in other places but are not unique or special enough to be in their own package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanConnect

func CanConnect(e *etcd.Client, sshkey string) (user string, allowed bool)

CanConnect checks a given SSH key against the list of authorized users in etcd to check if a user with a given key is allowed to connect. It takes in an active etcd.Client struct pointer and the ssh key to test and returns a username and boolean representing if they are allowed to connect.

func FPAddColons

func FPAddColons(s string) (r string)

addColons adds colons every second character in a string to make the formatting of a public key fingerprint match the common standard:

dd3bb82e850406e9abffa80ac0046ed6

becomes

dd:3b:b8:2e:85:04:06:e9:ab:ff:a8:0a:c0:04:6e:d6

func GetFingerprint

func GetFingerprint(key string) string

getFingerprint takes an SSH key in and returns the fingerprint (an MD5 sum) and adds the needed colons to it.

func HashPassword

func HashPassword(password, salt []byte) []byte

HashPassword hashes a password with pbkdf2. This is probably good enough.

func Reply

func Reply(r *render.Render, w http.ResponseWriter, message string, code int, data ...interface{})

Reply takes in a render instance, an http responsewriter, a message string, http status code and additional data to return to the user. This needs a "return" call after being run.

Types

This section is empty.

Jump to

Keyboard shortcuts

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