Documentation
¶
Index ¶
- Constants
- func CopyHeaders(from http.Header, to http.Header)
- func GetServerFullName() string
- func GetServerName() string
- func GetServerVersion() string
- func InitLogger(verbose bool) *log.Logger
- func NewAgentHandler(config *ServerConfig, agent *Agent) http.Handler
- func NewAgentProfile(exp string, mod string) string
- func NewClient(skip bool) *http.Client
- func NewProxyHandler(config *ServerConfig, proxy *Proxy) http.Handler
- func NewRSAKey(bits int) (*rsa.PrivateKey, string, string, error)
- func NewRSAcert(uri string, name string, priv *rsa.PrivateKey) (*tls.Certificate, error)
- func NewTLSConfig(config *ServerConfig) (*tls.Config, error)
- func SetRequestTimeout(sec int)
- func WebIDFromBytes(cert []byte) (string, error)
- func WebIDFromCert(cert *tls.Certificate) (string, error)
- func WebIDFromReq(req *http.Request) (string, error)
- type Agent
- type Proxy
- type RSAAuthentication
- type RSAAuthorization
- type ServerConfig
- type Signer
- type Verifier
Constants ¶
const ( // ServerVersion is used to display the server version number during HTTP requests ServerVersion = "v2.1.3" // ServerName is used to display the server name during HTTP requests ServerName = "SolidProxy" )
Variables ¶
This section is empty.
Functions ¶
func CopyHeaders ¶
CopyHeaders is used to copy headers between two http.Header objects (usually two request/response objects)
func GetServerFullName ¶
func GetServerFullName() string
GetServerFullName returns the concatenated server name and version
func GetServerVersion ¶
func GetServerVersion() string
GetServerVersion returns the current server version
func InitLogger ¶
InitLogger is used to initialize the log system; if verbose is set to false, it will discard all messages
func NewAgentHandler ¶
func NewAgentHandler(config *ServerConfig, agent *Agent) http.Handler
NewAgentHandler creates a new http.Handler object using the provided server configuration and agent object
func NewAgentProfile ¶
NewAgentProfile returns a new WebID profile document for the agent
func NewClient ¶
NewClient creates a new http.Client object to be used for fetching resources. The skip parameter is used to indicate if the client should ship server certificate verification.
func NewProxyHandler ¶
func NewProxyHandler(config *ServerConfig, proxy *Proxy) http.Handler
NewProxyHandler creates a new server handler
func NewRSAcert ¶
func NewRSAcert(uri string, name string, priv *rsa.PrivateKey) (*tls.Certificate, error)
NewRSAcert creates a new RSA x509 self-signed certificate to use for WebID-TLS authentication
func NewTLSConfig ¶
func NewTLSConfig(config *ServerConfig) (*tls.Config, error)
NewTLSConfig creates an new tls.Config object based on the provided server configuration
func SetRequestTimeout ¶
func SetRequestTimeout(sec int)
SetRequestTimeout sets the timeout value in seconds for all request
func WebIDFromBytes ¶
WebIDFromBytes takes a certificate and extracts the subjectAlternativeName value from it.
func WebIDFromCert ¶
func WebIDFromCert(cert *tls.Certificate) (string, error)
WebIDFromCert returns a WebID value (URI) from a given tls.Certificate
Types ¶
type Agent ¶
type Agent struct { WebID string Profile string Cert *tls.Certificate Key *rsa.PrivateKey Log *log.Logger }
Agent is a structure which contains all the information necessary for WebID-TLS auth.
func NewAgentLocal ¶
NewAgentLocal creates a new agent object together with a full profile and certificate
func (*Agent) Handler ¶
func (agent *Agent) Handler(w http.ResponseWriter, req *http.Request)
Handler function handles requests for the agent's WebID profile document
func (*Agent) NewAgentClient ¶
NewAgentClient creates a new http.Client to be used for agent requests. The skip parameter is used to indicate if the client should ship server certificate verification.
func (*Agent) NewRSAAuthorizationHeader ¶
func (agent *Agent) NewRSAAuthorizationHeader(auth *RSAAuthentication) (string, error)
NewRSAAuthorizationHeader returns a new Authorization header for WebID-RSA auth
type Proxy ¶
type Proxy struct { HTTPClient *http.Client HTTPAgentClient *http.Client Log *log.Logger Agent *Agent }
Proxy is a structure that encapsulates both clients (agent and fetcher), agent object and logger object.
func NewProxy ¶
NewProxy returns a new Proxy object based on the provided agent configuration. The skip parameter is used to indicate if the client should ship server certificate verification.
type RSAAuthentication ¶
type RSAAuthentication struct {
Source, Nonce, Username string
}
RSAAuthentication structure
func ParseRSAAuthenticateHeader ¶
func ParseRSAAuthenticateHeader(header string) (*RSAAuthentication, error)
ParseRSAAuthenticateHeader parses an Authenticate header and returns an RSAAuthentication object
type RSAAuthorization ¶
type RSAAuthorization struct {
Source, Username, Nonce, Signature string
}
RSAAuthorization structure
type ServerConfig ¶
type ServerConfig struct { Verbose bool InsecureSkipVerify bool Version string Agent string EnableTLS bool TLSKey string TLSCert string Port string }
ServerConfig contains all the configuration parameters for the proxy server
func NewServerConfig ¶
func NewServerConfig() *ServerConfig
NewServerConfig creates a new ServerConfig object with a few default settings
type Signer ¶
Signer creates signatures that verify against a public key.
func ParseRSAPrivatePEMKey ¶
ParseRSAPrivatePEMKey parses a PEM encoded private key and returns a Signer.
type Verifier ¶
Verifier verifies signatures against a public key.
func ParseRSAPublicPEMKey ¶
ParseRSAPublicPEMKey parses a PEM encoded private key and returns a new verifier object