Documentation
¶
Index ¶
- Variables
- type Request
- func (self *Request) HostName() string
- func (self *Request) LoadCert(cert *x509.Certificate, key crypto.Signer) error
- func (self *Request) LoadCertKey(certPem []byte, keyPem []byte) error
- func (self *Request) LoadCertKeyFiles(certPath string, keyPath string) error
- func (self *Request) Send(config ...*tls.Config) (response Response, err error)
- func (self *Request) SendWithTimeout(timeout time.Duration, config ...*tls.Config) (response Response, err error)
- func (self *Request) SetBody(body io.Reader, size ...int64) error
- func (self *Request) SetDelete()
- func (self *Request) Url() (*url.URL, error)
- func (self *Request) UrlString() string
- type Response
- func (self *Response) Close() error
- func (self *Response) HasBody() bool
- func (self *Response) IsCertFail() bool
- func (self *Response) IsInput() bool
- func (self *Response) IsPermFail() bool
- func (self *Response) IsRedirect() bool
- func (self *Response) IsSuccess() bool
- func (self *Response) IsTempFail() bool
- func (self *Response) Read(d []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNoBody = errors.New("Response has no body")
The response was attempted to be read, but there is no body
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { // Method of the request Method gmitools.Method // Host of the request. This includes the port if applicable Host string // Path component Path string // Query component without question mark Query string // Token to send if this is a titan request Token string // Content type of the body if this is a titan request ContentType string // Body to send if this is a titan request Body io.Reader // The size of the body Size int64 // Client certificate to send Cert *tls.Certificate }
Client request struct
The information that will be sent with a gemini client request
func (*Request) LoadCertKey ¶
Load the client certificate from PEM encoded bodies
func (*Request) LoadCertKeyFiles ¶
Load the client certificate from PEM encoded files
func (*Request) SendWithTimeout ¶
func (self *Request) SendWithTimeout(timeout time.Duration, config ...*tls.Config) (response Response, err error)
Send the request with a connection timeout
Once the connection has been made, the request will wait until the server closes the connection ignoring the timeout.
config is an optional tls Configuration
func (*Request) SetBody ¶
Set the body of the titan request
size is an optional parameter. If it is not provided, then the size will be determined from the body.
The body will be read into memory if size is not supplied and body is not also a seeker.
func (*Request) SetDelete ¶
func (self *Request) SetDelete()
Set the titan request to be a delete operation.
type Response ¶
type Response struct { // The returned status code Status gmitools.StatusCode // The meta value Meta string // The body of the response Body io.ReadCloser // The tls connection state of the response State tls.ConnectionState }
Gemini Response struct
The response should be closed when done.
func (*Response) IsCertFail ¶
Check if the response is in the certificate failure class (6X)
func (*Response) IsPermFail ¶
Check if the response is in the permanent failure class (5X)
func (*Response) IsRedirect ¶
Check if the response is in the redirect class (3X)
func (*Response) IsTempFail ¶
Check if the response is in the temporary failure class (4X)