Documentation ¶
Index ¶
- Variables
- func CreateSSLCert(filename string, content string) string
- func GetServerCertificate() (string, string)
- func GetServerPKI() (*rsa.PrivateKey, *rsa.PublicKey)
- func Use(h http.Handler, m ...Middleware) http.Handler
- type JWT
- type Middleware
- func IsAllowedIPs(allowedIps string) Middleware
- func IsAllowedOrigin(allowedOrigin string) Middleware
- func IsAuthenticated(jwt JWT) Middleware
- func IsAuthorized(jwt JWT) Middleware
- func IsThrottle() Middleware
- func NoAuthentication() Middleware
- func Preflight() Middleware
- func ProcessTimeout(timeout time.Duration) Middleware
- func SetHeaders() Middleware
- type Params
- type Response
- type Server
- type Throttle
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var Limiter = NewThrottle()
Functions ¶
func CreateSSLCert ¶ added in v0.1.0
CreateSSLCert makes cert in image
func GetServerCertificate ¶ added in v0.0.22
GetServerCertificate returns private and public key
func GetServerPKI ¶ added in v0.0.29
func GetServerPKI() (*rsa.PrivateKey, *rsa.PublicKey)
GetServerPKI returns public key infrustructure
Types ¶
type JWT ¶
type JWT interface { CreateToken(tokenInfo TokenInfo) (string, error) IsValidToken(r *http.Request) bool GetTokenInfo(r *http.Request) (*TokenInfo, error) Secret() string }
JWT
type Middleware ¶
Middleware strct
func IsAllowedIPs ¶ added in v0.1.5
func IsAllowedIPs(allowedIps string) Middleware
IsAllowedIPs allow specific IP address
func IsAllowedOrigin ¶ added in v0.1.5
func IsAllowedOrigin(allowedOrigin string) Middleware
IsAllowedOrigin enable cors within the http handler
func IsAuthenticated ¶ added in v0.1.5
func IsAuthenticated(jwt JWT) Middleware
IsAuthenticated validates request for jwt header
func IsAuthorized ¶ added in v0.1.5
func IsAuthorized(jwt JWT) Middleware
IsAuthorized validate if users is allowed to access route
func NoAuthentication ¶ added in v0.1.5
func NoAuthentication() Middleware
NoAuthentication access without authentications
func ProcessTimeout ¶ added in v0.1.0
func ProcessTimeout(timeout time.Duration) Middleware
ProcessTimeout put a time limit for the handler process duration and will give an error response if timeout
type Params ¶ added in v0.0.12
type Params struct { ID string `json:"id,omitempty"` Params interface{} `json:"params,omitempty"` Cipher string `json:"cipher,omitempty"` }
Params
type Response ¶
type Response struct { Result string `json:"result,omitempty"` Cipher string `json:"cipher,omitempty"` }
Response result
type Server ¶ added in v0.1.0
type Server struct { Name string Env string URI string Mux *http.ServeMux Cache *cache.Cache Database database.Database JWT JWT Logger *logrus.Logger ServerPublicKey *rsa.PublicKey Timeout uint64 // contains filtered or unexported fields }
Server struct
Click to show internal directories.
Click to hide internal directories.