transport

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

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

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 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.

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 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.

func GetTransportOptions

func GetTransportOptions(transportOptsURL string) (*TransportOptions, bool)

GetTransportOptions returns a TransportOptions that matches the transportOptsURL. No matches returns nil with false.

Jump to

Keyboard shortcuts

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