Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRepo = errors.New("invalid repo")
ErrInvalidRepo represents an attempt to access a non-existent repo.
var ErrNotAuthed = errors.New("you are not authorized to do this")
ErrNotAuthed represents unauthorized access.
var ErrSystemMalfunction = errors.New("something went wrong")
ErrSystemMalfunction represents a general system error returned to clients.
Functions ¶
func EnsureRepo ¶
EnsureRepo makes sure the given repo exists within the given dir, and that it is git repository.
If path does not exist, it'll be created. If the path is not a git repo, it will be git init-ed as a bare repository.
func Fatal ¶
func Fatal(s ssh.Session, v ...interface{})
Fatal prints to the session's STDOUT as a git response and exit 1.
func Middleware ¶
Middleware adds Git server functionality to the ssh.Server. Repos are stored in the specified repo directory. The provided Hooks implementation will be checked for access on a per repo basis for a ssh.Session public key. Hooks.Push and Hooks.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 does not allow access to the repo. NoAccess AccessLevel = iota // ReadOnlyAccess allows read-only access to the repo. ReadOnlyAccess // ReadWriteAccess allows read and write access to the repo. ReadWriteAccess // AdminAccess allows read, write, and admin access to the repo. AdminAccess )
type GitHooks
deprecated
type GitHooks = Hooks // nolint: revive
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.
Deprecated: use Hooks instead.
type Hooks ¶
type Hooks interface { AuthRepo(string, ssh.PublicKey) AccessLevel Push(string, ssh.PublicKey) Fetch(string, ssh.PublicKey) }
Hooks 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.