net

package
v0.0.0-...-4ca8788 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 19 Imported by: 10

Documentation

Index

Constants

View Source
const Command = "command"
View Source
const QueryType = "qType"
View Source
const QueryTypeCount = "count"
View Source
const QueryTypeExist = "exist"
View Source
const QueryTypeFind = "find"

Variables

This section is empty.

Functions

func CorsAllowAll

func CorsAllowAll(w http.ResponseWriter)

func CorsWrap

func CorsWrap(allowPattern string, h http.Handler) http.Handler

func Decode

func Decode(item interface{}, r *http.Request) (err error)

func DeleteById

func DeleteById(id interface{}, url string, client *http.Client) (err error)

func DownloadFromURL

func DownloadFromURL(url string, to string) (name string, err error)

func FormatRequest

func FormatRequest(r *http.Request) string

formatRequest generates ascii representation of a request

func FormatRequestFrom

func FormatRequestFrom(r *http.Request) string

func GetItems

func GetItems(items interface{}, url string, client *http.Client) (err error)

func GetQueryOrFormValue

func GetQueryOrFormValue(paramName string, r *http.Request) (ret string)

func LogBody

func LogBody(w http.ResponseWriter, r *http.Request) bool

func PostById

func PostById(item interface{}, id interface{}, url string, client *http.Client) (err error)

func ResponseJson

func ResponseJson(response interface{}, w http.ResponseWriter) error

func ResponseJsonCode

func ResponseJsonCode(response interface{}, code int, w http.ResponseWriter) (err error)

func ResponseResultErr

func ResponseResultErr(err error, msg string, item interface{}, code int, w http.ResponseWriter) error

func ResponseResultOk

func ResponseResultOk(msg string, item interface{}, w http.ResponseWriter) error

Types

type AccountToken

type AccountToken struct {
	Account interface{}
	Token   string `json:"token"`
}

type JwtController

type JwtController struct {
	// contains filtered or unexported fields
}

func NewJwtController

func NewJwtController(appName string, rsaKeys *RsaKeys, useHttpCookie bool,
	authenticator func(UserCredentials) (ret interface{}, err error)) *JwtController

func NewJwtControllerApp

func NewJwtControllerApp(certsFolder string, appName string,
	authenticator func(UserCredentials) (ret interface{}, err error)) (ret *JwtController, err error)

func (*JwtController) ExtractToken

func (o *JwtController) ExtractToken(r *http.Request) (ret string, err error)

func (*JwtController) LoginHandler

func (o *JwtController) LoginHandler() http.HandlerFunc

func (*JwtController) Logout

func (o *JwtController) Logout(w http.ResponseWriter)

func (*JwtController) LogoutHandler

func (o *JwtController) LogoutHandler() http.HandlerFunc

func (*JwtController) Setup

func (o *JwtController) Setup() (err error)

func (*JwtController) ValidateToken

func (o *JwtController) ValidateToken(w http.ResponseWriter, r *http.Request, next http.Handler)

func (*JwtController) ValidateTokenHandler

func (o *JwtController) ValidateTokenHandler(protected http.Handler) http.HandlerFunc

type Response

type Response struct {
	Data string `json:"data"`
}

type Result

type Result struct {
	Ok   bool        `json:"ok,omitempty"`
	Item interface{} `json:"item,omitempty"`
	Msg  string      `json:"msg,omitempty"`
	Err  string      `json:"err,omitempty"`
}

type RsaKeys

type RsaKeys struct {
	// contains filtered or unexported fields
}

func RsaKeysNew

func RsaKeysNew(keysFolder string, baseFileName string) *RsaKeys

func (*RsaKeys) Create

func (o *RsaKeys) Create() (err error)

func (*RsaKeys) Exists

func (o *RsaKeys) Exists() (ret bool)

func (*RsaKeys) LoadOrCreate

func (o *RsaKeys) LoadOrCreate() (err error)

func (*RsaKeys) Private

func (o *RsaKeys) Private() *rsa.PrivateKey

func (*RsaKeys) Public

func (o *RsaKeys) Public() *rsa.PublicKey

func (*RsaKeys) RsaFile

func (o *RsaKeys) RsaFile() string

func (*RsaKeys) RsaPubFile

func (o *RsaKeys) RsaPubFile() string

type UserCredentials

type UserCredentials struct {
	Username string
	Password string
}

Directories

Path Synopsis
Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321.
Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321.

Jump to

Keyboard shortcuts

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