Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRepo = fmt.Errorf("invalid repo")
ErrInvalidRepo represents an attempt to access a non-existent repo
var ErrNotAuthed = fmt.Errorf("you are not authorized to do this")
ErrNotAuthed represents unauthorized access.
var ErrSystemMalfunction = fmt.Errorf("something went wrong")
ErrSystemMalfunction represents a general system error returned to clients.
Functions ¶
func Middleware ¶
func Middleware(repoDir string, gh GitHooks) wish.Middleware
Middleware adds Git server functionality to the ssh.Server. Repos are stored in the specified repo directory. The provided GitHooks implementation will be checked for access on a per repo basis for a ssh.Session public key. GitHooks.Push and GitHooks.Fetch will be called on successful completion of their commands.
Types ¶
type AccessLevel ¶
type AccessLevel int
AccessLevel is the level of access allowed to a repo.
const ( NoAccess AccessLevel = iota ReadOnlyAccess ReadWriteAccess AdminAccess )
type GitHooks ¶
type GitHooks interface {
AuthRepo(string, ssh.PublicKey) AccessLevel
Push(string, ssh.PublicKey)
Fetch(string, ssh.PublicKey)
}
GitHooks is an interface that allows for custom authorization implementations and post push/fetch notifications. Prior to git access, AuthRepo will be called with the ssh.Session public key and the repo name. Implementers return the appropriate AccessLevel.