tls

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: MIT Imports: 4 Imported by: 0

README

gentleman/tls Build Status GoDoc Go Report Card

gentleman's plugin to easily define TLS config used by http.Transport/RoundTripper interface.

Installation

go get -u gopkg.in/h2non/gentleman.v2/plugins/tls

API

See godoc reference.

Example

package main

import (
  "fmt"
  "crypto/tls"
  "gopkg.in/h2non/gentleman.v2"
  "gopkg.in/h2non/gentleman.v2/plugins/tls"
)

func main() {
  // Create a new client
  cli := gentleman.New()

  // Define a custom header
  cli.Use(tls.Config(&tls.Config{ServerName: "foo.com"}))

  // Perform the request
  res, err := cli.Request().URL("http://httpbin.org/headers").Send()
  if err != nil {
    fmt.Printf("Request error: %s\n", err)
    return
  }
  if !res.Ok {
    fmt.Printf("Invalid server response: %d\n", res.StatusCode)
    return
  }

  fmt.Printf("Status: %d\n", res.StatusCode)
  fmt.Printf("Body: %s", res.String())
}

License

MIT - Tomas Aparicio

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(config *tls.Config) p.Plugin

Config defines the request TLS connection config

Types

This section is empty.

Jump to

Keyboard shortcuts

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