Documentation
¶
Index ¶
Constants ¶
const ( StdOutKey = ":stdout:" StdErrKey = ":stderr:" )
const ( DefaultTimeout = time.Second * 30 DefaultFollowRedirects = false DefaultInsecure = false InMemoryStoreVal = ":memory:" )
const ( EnvRC = "LIBGEMINI_RC" EnvFollowRedirects = "LIBGEMINI_FOLLOW_REDIRECTS" EnvStorePath = "LIBGEMINI_STORE_PATH" EnvDumpHeaders = "LIBGEMINI_DUMP_HEADERS" EnvTrace = "LIBGEMINI_TRACE" EnvInsecure = "LIBGEMINI_INSECURE" KeyRC = "RC" KeyFollowRedirects = "FollowRedirects" KeyStorePath = "StorePath" KeyDumpHeaders = "DumpHeaders" KeyTrace = "Trace" KeyInsecure = "Insecure" )
const ( ConfigFollowRedirects = "follow" ConfigStore = "store" ConfigDumpHeaders = "dump-headers" ConfigTrace = "trace" ConfigInsecure = "insecure" )
const ( UserRWAllR = fs.FileMode(0o644) UserRWXAllNone = fs.FileMode(0o700) )
const (
CRLF = "\r\n"
)
const (
TerminatorSize = 2 // Size of \r\n.
)
Variables ¶
This section is empty.
Functions ¶
func NewLoggerFromPath ¶
NewLoggerFromPath will take in a path and if it's empty it will return a logger using a NoopHandler, otherwise it will try to initialize a FileHandler based on the filepath. It is expected to be used alongside a context. Use :stderr: or :stdout: to use StdErr or StdOut as outputs.
Types ¶
type Client ¶
func (*Client) Do ¶
Do will call DoWithContext, passing in a context.WithTimeout set to c.Timeout. See: DoWithContext for more information.
func (*Client) DoWithContext ¶
DoWithContext will dial the host, connect to it, finally writing the request on the connection.
type FileHandler ¶
func NewFileHandler ¶
func NewFileHandler(ctx context.Context, wc io.WriteCloser) FileHandler
type Header ¶
type Header struct { Meta string Status StatusCode }
type NoopCloser ¶
func (NoopCloser) Close ¶
func (NoopCloser) Close() error
type NoopHandler ¶
type NoopHandler struct{}
type OptsFn ¶
type OptsFn func(*Options)
func WithInMemoryStore ¶
func WithInMemoryStore() OptsFn
func WithInsecure ¶
func WithInsecure() OptsFn
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is a simple struct which wraps around a url.URL, providing a few methods around it.
func NewRequest ¶
NewRequest will take a raw url and parse it into a url.URL version. It will take care of setting some fields, like the scheme and port, if they are blank.
type StatusCode ¶
type StatusCode uint16
const ( Unset StatusCode = 0 Input StatusCode = 10 SensitiveInput StatusCode = 11 Success StatusCode = 20 RedirectTemporary StatusCode = 30 RedirectPermanent StatusCode = 31 TemporaryFailure StatusCode = 40 CGIError StatusCode = 42 ProxyError StatusCode = 43 SlowDown StatusCode = 44 PermanentFailure StatusCode = 50 NotFound StatusCode = 51 ClientCertificatedRequired StatusCode = 60 CertificateNotAuthorized StatusCode = 61 CertificateNotValid StatusCode = 62 )
func (StatusCode) IsSuccess ¶
func (code StatusCode) IsSuccess() bool
func (StatusCode) String ¶
func (code StatusCode) String() string