client

package
v4.0.0-rc8+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var Protocols = map[string]transport.Transport{
	"http":  http.DefaultClient,
	"https": http.DefaultClient,
	"ssh":   ssh.DefaultClient,
	"git":   git.DefaultClient,
	"file":  file.DefaultClient,
}

Protocols are the protocols supported by default.

Functions

func InstallProtocol

func InstallProtocol(scheme string, c transport.Transport)

InstallProtocol adds or modifies an existing protocol.

Example
package main

import (
	"crypto/tls"
	"net/http"

	"srcd.works/go-git.v4/plumbing/transport/client"
	githttp "srcd.works/go-git.v4/plumbing/transport/http"
)

func main() {
	// Create custom net/http client that.
	httpClient := &http.Client{
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
	}

	// Install it as default client for https URLs.
	client.InstallProtocol("https", githttp.NewClient(httpClient))
}
Output:

func NewClient

func NewClient(endpoint transport.Endpoint) (transport.Transport, error)

NewClient returns the appropriate client among of the set of known protocols: http://, https://, ssh:// and file://. See `InstallProtocol` to add or modify protocols.

Types

This section is empty.

Jump to

Keyboard shortcuts

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