network

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResponse added in v1.5.0

func CreateResponse(msg string, params ResponseParams) []byte

CreateResponse creates a generic HTTP response in JSON format.

func ExtractDomainFromURL added in v1.5.0

func ExtractDomainFromURL(hostURL *url.URL, keepSubdomain bool) string

ExtractDomainFromURL extracts the domain name (domain.tld or subdomain.domain.tld) from a URL.

func GenerateURL

func GenerateURL(host string, path string, params URLParams) (*url.URL, error)

GenerateURL creates a URL object from a host, path and optional parameters.

func ReadEndpoint

func ReadEndpoint(host string, path string, params URLParams) ([]byte, error)

ReadEndpoint reads data from an HTTP endpoint.

Types

type ResponseParams added in v1.5.0

type ResponseParams map[string]interface{}

ResponseParams holds parameters of an HTTP response.

type URLParams

type URLParams map[string]string

URLParams holds Key-Value URL parameters; it is a simpler form of url.Values.

Jump to

Keyboard shortcuts

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