Documentation ¶
Index ¶
- Constants
- func ErrResp[T RespType](c *gin.Context, origin *T, err string)
- func ErrUnAuthorized(c *gin.Context, err string)
- func GetProtoRequest[T ReqType](c *gin.Context) (r *T, err error)
- func GetServerMessageRequest[T ReqType](b []byte, r *T, trans func(b []byte, m protoreflect.ProtoMessage) error) (err error)
- func GetUserInfo(c context.Context) models.UserInfo
- func GlobalClientID(username, clientType, clientID string) string
- func OKResp[T RespType](c *gin.Context, origin *T)
- func ProtoResp[T RespType](origin *T) (*pb.ClientMessage, error)
- func Wrapper[T ReqType, U RespType](handler func(context.Context, *T) (*U, error)) func(c *gin.Context)
- func WrapperServerMsg[T ReqType, U RespType](req *pb.ServerMessage, handler func(context.Context, *T) (*U, error)) *pb.ClientMessage
- type ReqType
- type RespType
- type Result
Constants ¶
View Source
const ( AuthorizationKey = "authorization" SetAuthorizationKey = "x-set-authorization" MsgKey = "msg" UserIDKey = "x-vaala-userid" EndpointKey = "endpoint" IpAddrKey = "ipaddr" HeaderKey = "header" MethodKey = "method" UAKey = "User-Agent" ContentTypeKey = "Content-Type" TraceIDKey = "TraceID" TokenKey = "token" FRPAuthTokenKey = "token" ErrKey = "err" UserInfoKey = "x-vaala-userinfo" FRPClientIDKey = "x-vaala-frp-client-id" )
View Source
const ( ErrInvalidRequest = "invalid request" ErrUserInfoNotValid = "user info not valid" ErrInternalError = "internal error" ErrParamNotValid = "param not valid" ErrDB = "database error" ErrNotFound = "data not found" ErrCodeNotFound = "code not found" ErrCodeAlreadyUsed = "code already used" )
View Source
const ( StatusPending = "pending" StatusSuccess = "success" StatusFailed = "failed" StatusDone = "done" )
View Source
const ( CliTypeServer = "server" CliTypeClient = "client" )
View Source
const ( DefaultServerID = "default" DefaultAdminUserID = 1 )
View Source
const ( PullConfigDuration = 30 * time.Second PushProxyInfoDuration = 30 * time.Second )
View Source
const (
ReqSuccess = "success"
)
View Source
const (
TimeLayout = time.RFC3339
)
Variables ¶
This section is empty.
Functions ¶
func ErrUnAuthorized ¶
func GetServerMessageRequest ¶
func GetServerMessageRequest[T ReqType](b []byte, r *T, trans func(b []byte, m protoreflect.ProtoMessage) error) (err error)
func GlobalClientID ¶
func WrapperServerMsg ¶
func WrapperServerMsg[T ReqType, U RespType](req *pb.ServerMessage, handler func(context.Context, *T) (*U, error)) *pb.ClientMessage
Types ¶
type ReqType ¶
type ReqType interface { pb.UpdateFRPCRequest | pb.RemoveFRPCRequest | pb.UpdateFRPSRequest | pb.RemoveFRPSRequest | pb.CommonRequest | pb.RegisterRequest | pb.LoginRequest | pb.InitClientRequest | pb.ListClientsRequest | pb.GetClientRequest | pb.DeleteClientRequest | pb.InitServerRequest | pb.ListServersRequest | pb.GetServerRequest | pb.DeleteServerRequest | pb.GetUserInfoRequest | pb.UpdateUserInfoRequest | pb.GetPlatformInfoRequest | pb.GetClientsStatusRequest | pb.GetClientCertRequest | pb.StartFRPCRequest | pb.StopFRPCRequest | pb.StartFRPSRequest | pb.StopFRPSRequest | pb.GetProxyByCIDRequest | pb.GetProxyBySIDRequest }
type RespType ¶
type RespType interface { pb.UpdateFRPCResponse | pb.RemoveFRPCResponse | pb.UpdateFRPSResponse | pb.RemoveFRPSResponse | pb.CommonResponse | pb.RegisterResponse | pb.LoginResponse | pb.InitClientResponse | pb.ListClientsResponse | pb.GetClientResponse | pb.DeleteClientResponse | pb.InitServerResponse | pb.ListServersResponse | pb.GetServerResponse | pb.DeleteServerResponse | pb.GetUserInfoResponse | pb.UpdateUserInfoResponse | pb.GetPlatformInfoResponse | pb.GetClientsStatusResponse | pb.GetClientCertResponse | pb.StartFRPCResponse | pb.StopFRPCResponse | pb.StartFRPSResponse | pb.StopFRPSResponse | pb.GetProxyByCIDResponse | pb.GetProxyBySIDResponse }
Click to show internal directories.
Click to hide internal directories.