Documentation ¶
Index ¶
- Variables
- func AWSDecode(r events.APIGatewayProxyRequest, rqt proto.Message) (events.APIGatewayProxyResponse, error)
- func AWSError(status Transmission, err error) (events.APIGatewayProxyResponse, error)
- func AWSResponse(pb proto.Message) (events.APIGatewayProxyResponse, error)
- func CreateToken(pb proto.Message) (string, error)
- func EnableCORS()
- func GCPDecode(r *http.Request, w http.ResponseWriter, rqt proto.Message) bool
- func GCPError(w http.ResponseWriter, status Transmission, err error)
- func GCPResponse(w http.ResponseWriter, pb proto.Message)
- func SetupCORS(allowCredentials bool, allowOrigin string, allowHeaders string, ...)
- func SetupHS256Token(issuer string, key string, maxAge time.Duration)
- func SetupToken(method jwt.SigningMethod, issuer string, key interface{}, maxAge time.Duration)
- func ValidateToken(sessionToken string, pb proto.Message) error
- type GenericErrorResponse
- func (*GenericErrorResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GenericErrorResponse) GetError() string
- func (*GenericErrorResponse) ProtoMessage()
- func (x *GenericErrorResponse) ProtoReflect() protoreflect.Message
- func (x *GenericErrorResponse) Reset()
- func (x *GenericErrorResponse) String() string
- type GenericRequest
- type GenericResponse
- type Transmission
- func (Transmission) Descriptor() protoreflect.EnumDescriptor
- func (x Transmission) Enum() *Transmission
- func (Transmission) EnumDescriptor() ([]byte, []int)deprecated
- func (x Transmission) Number() protoreflect.EnumNumber
- func (x Transmission) String() string
- func (Transmission) Type() protoreflect.EnumType
Constants ¶
This section is empty.
Variables ¶
var ( Transmission_name = map[int32]string{ 0: "NotSpecified", 1: "ErrorConnection", 2: "ErrorProtocol", 3: "ErrorParser", 200: "Success", 204: "ErrorNoData", 400: "ErrorDecode", 401: "ErrorUnauthorized", 403: "ErrorForbidden", 405: "ErrorMethodNotAllowed", 408: "ErrorRequestTimeout", 421: "ErrorEncode", 500: "ErrorInternalServer", 501: "ErrorNotImplemented", 511: "ErrorNetworkAuthenticationRequired", } Transmission_value = map[string]int32{ "NotSpecified": 0, "ErrorConnection": 1, "ErrorProtocol": 2, "ErrorParser": 3, "Success": 200, "ErrorNoData": 204, "ErrorDecode": 400, "ErrorUnauthorized": 401, "ErrorForbidden": 403, "ErrorMethodNotAllowed": 405, "ErrorRequestTimeout": 408, "ErrorEncode": 421, "ErrorInternalServer": 500, "ErrorNotImplemented": 501, "ErrorNetworkAuthenticationRequired": 511, } )
Enum value maps for Transmission.
var File_asyncrpc_proto protoreflect.FileDescriptor
Functions ¶
func AWSDecode ¶
func AWSDecode(r events.APIGatewayProxyRequest, rqt proto.Message) (events.APIGatewayProxyResponse, error)
AWSDecode decodes and returns the protobuf of given connection. Return to gateway (response,nil) if err != nil.
func AWSError ¶
func AWSError(status Transmission, err error) (events.APIGatewayProxyResponse, error)
AWSError writes an error response in given connection.
func AWSResponse ¶
func AWSResponse(pb proto.Message) (events.APIGatewayProxyResponse, error)
AWSResponse writes response in given connection.
func CreateToken ¶
CreateToken creates a token for an given user
func GCPDecode ¶
GCPDecode decodes and returns the protobuf of given connection. returns true if break by OPTIONS or error.
func GCPError ¶
func GCPError(w http.ResponseWriter, status Transmission, err error)
GCPError writes an error response in given connection.
func GCPResponse ¶
func GCPResponse(w http.ResponseWriter, pb proto.Message)
GCPResponse writes response in given connection.
func SetupCORS ¶
func SetupCORS(allowCredentials bool, allowOrigin string, allowHeaders string, allowMethods string, maxAge int)
SetupCORS enable CORS and configures AsyncNetworkEngine to accept methods, headers and etc from a given application. For more information about CORS and CORS preflight requests, see https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request.
func SetupHS256Token ¶ added in v0.4.0
func SetupToken ¶
SetupToken setup function to emit and validate tokens on behalf of the user in doubt about maxAge, use time.Hour
Types ¶
type GenericErrorResponse ¶
type GenericErrorResponse struct { Error string `protobuf:"bytes,1,opt,name=Error,proto3" json:"Error,omitempty"` // contains filtered or unexported fields }
func (*GenericErrorResponse) Descriptor
deprecated
func (*GenericErrorResponse) Descriptor() ([]byte, []int)
Deprecated: Use GenericErrorResponse.ProtoReflect.Descriptor instead.
func (*GenericErrorResponse) GetError ¶
func (x *GenericErrorResponse) GetError() string
func (*GenericErrorResponse) ProtoMessage ¶
func (*GenericErrorResponse) ProtoMessage()
func (*GenericErrorResponse) ProtoReflect ¶
func (x *GenericErrorResponse) ProtoReflect() protoreflect.Message
func (*GenericErrorResponse) Reset ¶
func (x *GenericErrorResponse) Reset()
func (*GenericErrorResponse) String ¶
func (x *GenericErrorResponse) String() string
type GenericRequest ¶
type GenericRequest struct { Messege string `protobuf:"bytes,1,opt,name=Messege,proto3" json:"Messege,omitempty"` // contains filtered or unexported fields }
func (*GenericRequest) Descriptor
deprecated
func (*GenericRequest) Descriptor() ([]byte, []int)
Deprecated: Use GenericRequest.ProtoReflect.Descriptor instead.
func (*GenericRequest) GetMessege ¶
func (x *GenericRequest) GetMessege() string
func (*GenericRequest) ProtoMessage ¶
func (*GenericRequest) ProtoMessage()
func (*GenericRequest) ProtoReflect ¶
func (x *GenericRequest) ProtoReflect() protoreflect.Message
func (*GenericRequest) Reset ¶
func (x *GenericRequest) Reset()
func (*GenericRequest) String ¶
func (x *GenericRequest) String() string
type GenericResponse ¶
type GenericResponse struct { Messege string `protobuf:"bytes,2,opt,name=Messege,proto3" json:"Messege,omitempty"` // contains filtered or unexported fields }
func (*GenericResponse) Descriptor
deprecated
func (*GenericResponse) Descriptor() ([]byte, []int)
Deprecated: Use GenericResponse.ProtoReflect.Descriptor instead.
func (*GenericResponse) GetMessege ¶
func (x *GenericResponse) GetMessege() string
func (*GenericResponse) ProtoMessage ¶
func (*GenericResponse) ProtoMessage()
func (*GenericResponse) ProtoReflect ¶
func (x *GenericResponse) ProtoReflect() protoreflect.Message
func (*GenericResponse) Reset ¶
func (x *GenericResponse) Reset()
func (*GenericResponse) String ¶
func (x *GenericResponse) String() string
type Transmission ¶
type Transmission int32
const ( Transmission_NotSpecified Transmission = 0 Transmission_ErrorConnection Transmission = 1 Transmission_ErrorProtocol Transmission = 2 Transmission_ErrorParser Transmission = 3 Transmission_Success Transmission = 200 // StatusOK Transmission_ErrorNoData Transmission = 204 //StatusNoContent Transmission_ErrorDecode Transmission = 400 //StatusBadRequest Transmission_ErrorForbidden Transmission = 403 //Forbidden Transmission_ErrorMethodNotAllowed Transmission = 405 //StatusMethodNotAllowed Transmission_ErrorRequestTimeout Transmission = 408 //StatusRequestTimeout Transmission_ErrorEncode Transmission = 421 //Misdirected Request Transmission_ErrorInternalServer Transmission = 500 //StatusInternalServerError Transmission_ErrorNotImplemented Transmission = 501 //StatusNotImplemented Transmission_ErrorNetworkAuthenticationRequired Transmission = 511 //NetworkAuthenticationRequired )
func (Transmission) Descriptor ¶
func (Transmission) Descriptor() protoreflect.EnumDescriptor
func (Transmission) Enum ¶
func (x Transmission) Enum() *Transmission
func (Transmission) EnumDescriptor
deprecated
func (Transmission) EnumDescriptor() ([]byte, []int)
Deprecated: Use Transmission.Descriptor instead.
func (Transmission) Number ¶
func (x Transmission) Number() protoreflect.EnumNumber
func (Transmission) String ¶
func (x Transmission) String() string
func (Transmission) Type ¶
func (Transmission) Type() protoreflect.EnumType