session

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "session"
)

Variables

View Source
var File_app_session_pb_request_proto protoreflect.FileDescriptor
View Source
var File_app_session_pb_service_proto protoreflect.FileDescriptor
View Source
var File_app_session_pb_session_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.keyauth.session.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Login",
			Handler:    _Service_Login_Handler,
		},
		{
			MethodName: "Logout",
			Handler:    _Service_Logout_Handler,
		},
		{
			MethodName: "DescribeSession",
			Handler:    _Service_DescribeSession_Handler,
		},
		{
			MethodName: "QuerySession",
			Handler:    _Service_QuerySession_Handler,
		},
		{
			MethodName: "QueryUserLastSession",
			Handler:    _Service_QueryUserLastSession_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "app/session/pb/service.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func HttpEntry

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type DescribeSessionRequest

type DescribeSessionRequest struct {
	SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Domain    string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
	Account   string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"`
	Login     bool   `protobuf:"varint,4,opt,name=login,proto3" json:"login,omitempty"`
	// contains filtered or unexported fields
}

DescribeSessionRequest todo

func NewDescribeSessionRequestWithID

func NewDescribeSessionRequestWithID(id string) *DescribeSessionRequest

NewDescribeSessionRequestWithID todo

func NewDescribeSessionRequestWithToken

func NewDescribeSessionRequestWithToken(tk *token.Token) *DescribeSessionRequest

NewDescribeSessionRequestWithToken todo

func (*DescribeSessionRequest) Descriptor deprecated

func (*DescribeSessionRequest) Descriptor() ([]byte, []int)

Deprecated: Use DescribeSessionRequest.ProtoReflect.Descriptor instead.

func (*DescribeSessionRequest) GetAccount

func (x *DescribeSessionRequest) GetAccount() string

func (*DescribeSessionRequest) GetDomain

func (x *DescribeSessionRequest) GetDomain() string

func (*DescribeSessionRequest) GetLogin

func (x *DescribeSessionRequest) GetLogin() bool

func (*DescribeSessionRequest) GetSessionId

func (x *DescribeSessionRequest) GetSessionId() string

func (*DescribeSessionRequest) HasAccount

func (req *DescribeSessionRequest) HasAccount() bool

HasAccount todo

func (*DescribeSessionRequest) ProtoMessage

func (*DescribeSessionRequest) ProtoMessage()

func (*DescribeSessionRequest) ProtoReflect

func (x *DescribeSessionRequest) ProtoReflect() protoreflect.Message

func (*DescribeSessionRequest) Reset

func (x *DescribeSessionRequest) Reset()

func (*DescribeSessionRequest) String

func (x *DescribeSessionRequest) String() string

func (*DescribeSessionRequest) Validate

func (req *DescribeSessionRequest) Validate() error

Validate todo

type IPInfo

type IPInfo struct {

	// @gotags: bson:"city_id" json:"city_id"
	CityId int64 `protobuf:"varint,1,opt,name=city_id,json=cityId,proto3" json:"city_id" bson:"city_id"`
	// @gotags: bson:"country" json:"country"
	Country string `protobuf:"bytes,2,opt,name=country,proto3" json:"country" bson:"country"`
	// @gotags: bson:"region" json:"region"
	Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region" bson:"region"`
	// @gotags: bson:"province" json:"province"
	Province string `protobuf:"bytes,4,opt,name=province,proto3" json:"province" bson:"province"`
	// @gotags: bson:"city" json:"city"
	City string `protobuf:"bytes,5,opt,name=city,proto3" json:"city" bson:"city"`
	// @gotags: bson:"isp" json:"isp"
	Isp string `protobuf:"bytes,6,opt,name=isp,proto3" json:"isp" bson:"isp"`
	// contains filtered or unexported fields
}

IPInfo todo

func (*IPInfo) Descriptor deprecated

func (*IPInfo) Descriptor() ([]byte, []int)

Deprecated: Use IPInfo.ProtoReflect.Descriptor instead.

func (*IPInfo) GetCity

func (x *IPInfo) GetCity() string

func (*IPInfo) GetCityId

func (x *IPInfo) GetCityId() int64

func (*IPInfo) GetCountry

func (x *IPInfo) GetCountry() string

func (*IPInfo) GetIsp

func (x *IPInfo) GetIsp() string

func (*IPInfo) GetProvince

func (x *IPInfo) GetProvince() string

func (*IPInfo) GetRegion

func (x *IPInfo) GetRegion() string

func (*IPInfo) ProtoMessage

func (*IPInfo) ProtoMessage()

func (*IPInfo) ProtoReflect

func (x *IPInfo) ProtoReflect() protoreflect.Message

func (*IPInfo) Reset

func (x *IPInfo) Reset()

func (*IPInfo) String

func (x *IPInfo) String() string

type LogoutRequest

type LogoutRequest struct {
	SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Account   string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
	// contains filtered or unexported fields
}

LogoutRequest 登出请求

func NewLogoutRequest

func NewLogoutRequest(sessionID string) *LogoutRequest

NewLogoutRequest todo

func (*LogoutRequest) Descriptor deprecated

func (*LogoutRequest) Descriptor() ([]byte, []int)

Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.

func (*LogoutRequest) GetAccount

func (x *LogoutRequest) GetAccount() string

func (*LogoutRequest) GetSessionId

func (x *LogoutRequest) GetSessionId() string

func (*LogoutRequest) ProtoMessage

func (*LogoutRequest) ProtoMessage()

func (*LogoutRequest) ProtoReflect

func (x *LogoutRequest) ProtoReflect() protoreflect.Message

func (*LogoutRequest) Reset

func (x *LogoutRequest) Reset()

func (*LogoutRequest) String

func (x *LogoutRequest) String() string

type QuerySessionRequest

type QuerySessionRequest struct {
	Page           *page.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page,omitempty"`
	Account        string            `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
	LoginIp        string            `protobuf:"bytes,3,opt,name=login_ip,json=loginIp,proto3" json:"login_ip,omitempty"`
	LoginCity      string            `protobuf:"bytes,4,opt,name=login_city,json=loginCity,proto3" json:"login_city,omitempty"`
	ApplicationId  string            `protobuf:"bytes,5,opt,name=application_id,json=applicationId,proto3" json:"application_id,omitempty"`
	GrantType      token.GrantType   `` /* 129-byte string literal not displayed */
	StartLoginTime int64             `protobuf:"varint,7,opt,name=start_login_time,json=startLoginTime,proto3" json:"start_login_time,omitempty"`
	EndLoginTime   int64             `protobuf:"varint,8,opt,name=end_login_time,json=endLoginTime,proto3" json:"end_login_time,omitempty"`
	Domain         string            `protobuf:"bytes,9,opt,name=domain,proto3" json:"domain,omitempty"`
	// contains filtered or unexported fields
}

QuerySessionRequest todo

func NewQuerySessionRequest

func NewQuerySessionRequest(pageReq *request.PageRequest) *QuerySessionRequest

NewQuerySessionRequest 列表查询请求

func NewQuerySessionRequestFromHTTP

func NewQuerySessionRequestFromHTTP(r *http.Request) (*QuerySessionRequest, error)

NewQuerySessionRequestFromHTTP 列表查询请求

func NewQuerySessionRequestFromToken

func NewQuerySessionRequestFromToken(tk *token.Token) *QuerySessionRequest

NewQuerySessionRequestFromToken 列表查询请求

func (*QuerySessionRequest) Descriptor deprecated

func (*QuerySessionRequest) Descriptor() ([]byte, []int)

Deprecated: Use QuerySessionRequest.ProtoReflect.Descriptor instead.

func (*QuerySessionRequest) GetAccount

func (x *QuerySessionRequest) GetAccount() string

func (*QuerySessionRequest) GetApplicationId

func (x *QuerySessionRequest) GetApplicationId() string

func (*QuerySessionRequest) GetDomain

func (x *QuerySessionRequest) GetDomain() string

func (*QuerySessionRequest) GetEndLoginTime

func (x *QuerySessionRequest) GetEndLoginTime() int64

func (*QuerySessionRequest) GetGrantType

func (x *QuerySessionRequest) GetGrantType() token.GrantType

func (*QuerySessionRequest) GetLoginCity

func (x *QuerySessionRequest) GetLoginCity() string

func (*QuerySessionRequest) GetLoginIp

func (x *QuerySessionRequest) GetLoginIp() string

func (*QuerySessionRequest) GetPage

func (x *QuerySessionRequest) GetPage() *page.PageRequest

func (*QuerySessionRequest) GetStartLoginTime

func (x *QuerySessionRequest) GetStartLoginTime() int64

func (*QuerySessionRequest) ProtoMessage

func (*QuerySessionRequest) ProtoMessage()

func (*QuerySessionRequest) ProtoReflect

func (x *QuerySessionRequest) ProtoReflect() protoreflect.Message

func (*QuerySessionRequest) Reset

func (x *QuerySessionRequest) Reset()

func (*QuerySessionRequest) String

func (x *QuerySessionRequest) String() string

func (*QuerySessionRequest) Validate

func (req *QuerySessionRequest) Validate() error

Validate todo

type QueryUserLastSessionRequest

type QueryUserLastSessionRequest struct {

	// @gotags: validate:"required"
	Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty" validate:"required"`
	// contains filtered or unexported fields
}

QueryUserLastSessionRequest todo

func NewQueryUserLastSessionRequest

func NewQueryUserLastSessionRequest(account string) *QueryUserLastSessionRequest

NewQueryUserLastSessionRequest todo

func (*QueryUserLastSessionRequest) Descriptor deprecated

func (*QueryUserLastSessionRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryUserLastSessionRequest.ProtoReflect.Descriptor instead.

func (*QueryUserLastSessionRequest) GetAccount

func (x *QueryUserLastSessionRequest) GetAccount() string

func (*QueryUserLastSessionRequest) ProtoMessage

func (*QueryUserLastSessionRequest) ProtoMessage()

func (*QueryUserLastSessionRequest) ProtoReflect

func (*QueryUserLastSessionRequest) Reset

func (x *QueryUserLastSessionRequest) Reset()

func (*QueryUserLastSessionRequest) String

func (x *QueryUserLastSessionRequest) String() string

func (*QueryUserLastSessionRequest) Validate

func (req *QueryUserLastSessionRequest) Validate() error

Validate todo

type ServiceClient

type ServiceClient interface {
	Login(ctx context.Context, in *token.Token, opts ...grpc.CallOption) (*Session, error)
	Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*Session, error)
	DescribeSession(ctx context.Context, in *DescribeSessionRequest, opts ...grpc.CallOption) (*Session, error)
	QuerySession(ctx context.Context, in *QuerySessionRequest, opts ...grpc.CallOption) (*Set, error)
	QueryUserLastSession(ctx context.Context, in *QueryUserLastSessionRequest, opts ...grpc.CallOption) (*Session, error)
}

ServiceClient is the client API for Service service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	Login(context.Context, *token.Token) (*Session, error)
	Logout(context.Context, *LogoutRequest) (*Session, error)
	DescribeSession(context.Context, *DescribeSessionRequest) (*Session, error)
	QuerySession(context.Context, *QuerySessionRequest) (*Set, error)
	QueryUserLastSession(context.Context, *QueryUserLastSessionRequest) (*Session, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Session

type Session struct {

	// 唯一ID
	// @gotags: bson:"_id" json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// 所处域
	// @gotags: bson:"domain" json:"domain"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" bson:"domain"`
	// 用户名称
	// @gotags: bson:"account" json:"account"
	Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account" bson:"account"`
	// 用户类型
	// @gotags: bson:"user_type" json:"user_type"
	UserType types.UserType `` /* 131-byte string literal not displayed */
	// 用户通过哪个端登录的
	// @gotags: bson:"application_id" json:"application_id"
	ApplicationId string `protobuf:"bytes,5,opt,name=application_id,json=applicationId,proto3" json:"application_id" bson:"application_id"`
	// 用户通过哪个端登录的
	// @gotags: bson:"application_name" json:"application_name"
	ApplicationName string `protobuf:"bytes,6,opt,name=application_name,json=applicationName,proto3" json:"application_name" bson:"application_name"`
	// 登录方式
	// @gotags: bson:"grant_type" json:"grant_type"
	GrantType token.GrantType `` /* 137-byte string literal not displayed */
	// 登录时间
	// @gotags: bson:"login_at" json:"login_at"
	LoginAt int64 `protobuf:"varint,8,opt,name=login_at,json=loginAt,proto3" json:"login_at" bson:"login_at"`
	// 登录IP
	// @gotags: bson:"login_ip" json:"login_ip"
	LoginIp string `protobuf:"bytes,9,opt,name=login_ip,json=loginIp,proto3" json:"login_ip" bson:"login_ip"`
	// 登出时间
	// @gotags: bson:"logout_at" json:"logout_at"
	LogoutAt int64 `protobuf:"varint,10,opt,name=logout_at,json=logoutAt,proto3" json:"logout_at" bson:"logout_at"`
	// 应用的网站地址
	// @gotags: bson:"access_token" json:"access_token"
	AccessToken string `protobuf:"bytes,11,opt,name=access_token,json=accessToken,proto3" json:"access_token" bson:"access_token"`
	// @gotags: bson:"user_agent" json:"user_agent"
	UserAgent *UserAgent `protobuf:"bytes,12,opt,name=user_agent,json=userAgent,proto3" json:"user_agent" bson:"user_agent"`
	// @gotags: bson:"ip_info" json:"ip_info"
	IpInfo *IPInfo `protobuf:"bytes,13,opt,name=ip_info,json=ipInfo,proto3" json:"ip_info" bson:"ip_info"`
	// contains filtered or unexported fields
}

Session 登录回话

func NewDefaultSession

func NewDefaultSession() *Session

NewDefaultSession todo

func NewSession

func NewSession(ip ip2region.Service, tk *token.Token) (*Session, error)

NewSession todo

func (*Session) Descriptor deprecated

func (*Session) Descriptor() ([]byte, []int)

Deprecated: Use Session.ProtoReflect.Descriptor instead.

func (*Session) GetAccessToken

func (x *Session) GetAccessToken() string

func (*Session) GetAccount

func (x *Session) GetAccount() string

func (*Session) GetApplicationId

func (x *Session) GetApplicationId() string

func (*Session) GetApplicationName

func (x *Session) GetApplicationName() string

func (*Session) GetDomain

func (x *Session) GetDomain() string

func (*Session) GetGrantType

func (x *Session) GetGrantType() token.GrantType

func (*Session) GetId

func (x *Session) GetId() string

func (*Session) GetIpInfo

func (x *Session) GetIpInfo() *IPInfo

func (*Session) GetLoginAt

func (x *Session) GetLoginAt() int64

func (*Session) GetLoginIp

func (x *Session) GetLoginIp() string

func (*Session) GetLogoutAt

func (x *Session) GetLogoutAt() int64

func (*Session) GetUserAgent

func (x *Session) GetUserAgent() *UserAgent

func (*Session) GetUserType

func (x *Session) GetUserType() types.UserType

func (*Session) ParseUserAgent

func (s *Session) ParseUserAgent(userAgent string)

ParseUserAgent todo

func (*Session) ProtoMessage

func (*Session) ProtoMessage()

func (*Session) ProtoReflect

func (x *Session) ProtoReflect() protoreflect.Message

func (*Session) Reset

func (x *Session) Reset()

func (*Session) String

func (x *Session) String() string

type Set

type Set struct {
	Total int64      `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	Items []*Session `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func NewSessionSet

func NewSessionSet() *Set

NewSessionSet 实例化

func (*Set) Add

func (s *Set) Add(item *Session)

Add 添加应用

func (*Set) Descriptor deprecated

func (*Set) Descriptor() ([]byte, []int)

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems

func (x *Set) GetItems() []*Session

func (*Set) GetTotal

func (x *Set) GetTotal() int64

func (*Set) IsEmpty

func (s *Set) IsEmpty() bool

IsEmpty 长度

func (*Set) Length

func (s *Set) Length() int

Length 长度

func (*Set) ProtoMessage

func (*Set) ProtoMessage()

func (*Set) ProtoReflect

func (x *Set) ProtoReflect() protoreflect.Message

func (*Set) Reset

func (x *Set) Reset()

func (*Set) String

func (x *Set) String() string

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) DescribeSession

func (UnimplementedServiceServer) Login

func (UnimplementedServiceServer) Logout

func (UnimplementedServiceServer) QuerySession

func (UnimplementedServiceServer) QueryUserLastSession

type UnsafeServiceServer

type UnsafeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.

type UserAgent

type UserAgent struct {

	// @gotags: bson:"os" json:"os"
	Os string `protobuf:"bytes,1,opt,name=os,proto3" json:"os" bson:"os"`
	// @gotags: bson:"platform" json:"platform"
	Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform" bson:"platform"`
	// @gotags: bson:"engine_name" json:"engine_name"
	EngineName string `protobuf:"bytes,3,opt,name=engine_name,json=engineName,proto3" json:"engine_name" bson:"engine_name"`
	// @gotags: bson:"engine_version" json:"engine_version"
	EngineVersion string `protobuf:"bytes,4,opt,name=engine_version,json=engineVersion,proto3" json:"engine_version" bson:"engine_version"`
	// @gotags: bson:"browser_name" json:"browser_name"
	BrowserName string `protobuf:"bytes,5,opt,name=browser_name,json=browserName,proto3" json:"browser_name" bson:"browser_name"`
	// @gotags: bson:"browser_version" json:"browser_version"
	BrowserVersion string `protobuf:"bytes,6,opt,name=browser_version,json=browserVersion,proto3" json:"browser_version" bson:"browser_version"`
	// contains filtered or unexported fields
}

UserAgent todo

func (*UserAgent) Descriptor deprecated

func (*UserAgent) Descriptor() ([]byte, []int)

Deprecated: Use UserAgent.ProtoReflect.Descriptor instead.

func (*UserAgent) GetBrowserName

func (x *UserAgent) GetBrowserName() string

func (*UserAgent) GetBrowserVersion

func (x *UserAgent) GetBrowserVersion() string

func (*UserAgent) GetEngineName

func (x *UserAgent) GetEngineName() string

func (*UserAgent) GetEngineVersion

func (x *UserAgent) GetEngineVersion() string

func (*UserAgent) GetOs

func (x *UserAgent) GetOs() string

func (*UserAgent) GetPlatform

func (x *UserAgent) GetPlatform() string

func (*UserAgent) ProtoMessage

func (*UserAgent) ProtoMessage()

func (*UserAgent) ProtoReflect

func (x *UserAgent) ProtoReflect() protoreflect.Message

func (*UserAgent) Reset

func (x *UserAgent) Reset()

func (*UserAgent) String

func (x *UserAgent) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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