managed

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URLMaxLength represents the max length for the entire URL
	// when cloning Git repositories via HTTP(S).
	URLMaxLength = 2048

	// PathMaxLength represents the max length for the path element
	// when cloning Git repositories via SSH.
	PathMaxLength = 4096
)

Variables

This section is empty.

Functions

func AddTransportOptions

func AddTransportOptions(transportOptsURL string, opts TransportOptions)

AddTransportOptions registers a TransportOptions object mapped to the provided transportOptsURL, which must be a valid URL, i.e. prefixed with "http://" or "ssh://", as it is used as a dummy URL for all git operations and the managed transports will only be invoked for the protocols that they have been registered for.

func CheckKnownHost added in v0.25.7

func CheckKnownHost(host string, knownHosts []byte, fingerprint []byte) error

CheckKnownHost checks whether the host being connected to is part of the known_hosts, and if so, it ensures the host fingerprint matches the fingerprint of the known host with the same name.

func Enabled

func Enabled() bool

Enabled defines whether the use of Managed Transport is enabled which is only true if InitManagedTransport was called successfully at least once.

This is only affects git operations that uses libgit2 implementation.

func InitManagedTransport

func InitManagedTransport() error

InitManagedTransport initialises HTTP(S) and SSH managed transport for git2go, and therefore only impact git operations using the libgit2 implementation.

This must run after git2go.init takes place, hence this is not executed within a init(). Regardless of the state in libgit2/git2go, this will replace the built-in transports.

This function will only register managed transports once, subsequent calls leads to no-op.

func KnownHostsCallback added in v0.25.0

func KnownHostsCallback(host string, knownHosts []byte) git2go.CertificateCheckCallback

knownHostCallback returns a CertificateCheckCallback that verifies the key of Git server against the given host and known_hosts for git.SSH Transports.

func RemoteCallbacks added in v0.25.0

func RemoteCallbacks() git2go.RemoteCallbacks

RemoteCallbacks constructs git2go.RemoteCallbacks with dummy callbacks.

func RemoveTransportOptions

func RemoveTransportOptions(transportOptsURL string)

RemoveTransportOptions removes the registerd TransportOptions object mapped to the provided id.

Types

type TransportOptions

type TransportOptions struct {
	TargetURL    string
	AuthOpts     *git.AuthOptions
	ProxyOptions *git2go.ProxyOptions
	Context      context.Context
}

TransportOptions represents options to be applied at transport-level at request time.

Jump to

Keyboard shortcuts

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