session

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_session_pb_request_proto protoreflect.FileDescriptor
View Source
var File_pkg_session_pb_service_proto protoreflect.FileDescriptor
View Source
var File_pkg_session_pb_session_proto protoreflect.FileDescriptor

Functions

func HttpEntry

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterAdminServiceServer

func RegisterAdminServiceServer(s *grpc.Server, srv AdminServiceServer)

func RegisterUserServiceServer

func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)

Types

type AdminServiceClient

type AdminServiceClient interface {
	QueryUserLastSession(ctx context.Context, in *QueryUserLastSessionRequest, opts ...grpc.CallOption) (*Session, error)
}

AdminServiceClient is the client API for AdminService 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.

type AdminServiceServer

type AdminServiceServer interface {
	QueryUserLastSession(context.Context, *QueryUserLastSessionRequest) (*Session, error)
	// contains filtered or unexported methods
}

AdminServiceServer is the server API for AdminService service. All implementations must embed UnimplementedAdminServiceServer for forward compatibility

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 {
	CityId   int64  `protobuf:"varint,1,opt,name=city_id,json=cityId,proto3" json:"city_id" bson:"city_id"`
	Country  string `protobuf:"bytes,2,opt,name=country,proto3" json:"country" bson:"country"`
	Region   string `protobuf:"bytes,3,opt,name=region,proto3" json:"region" bson:"region"`
	Province string `protobuf:"bytes,4,opt,name=province,proto3" json:"province" bson:"province"`
	City     string `protobuf:"bytes,5,opt,name=city,proto3" json:"city" bson:"city"`
	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   `protobuf:"varint,6,opt,name=grant_type,json=grantType,proto3,enum=keyauth.token.GrantType" json:"grant_type,omitempty"`
	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"`
	// 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) 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 {
	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 Session

type Session struct {

	// 唯一ID
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// 所处域
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" bson:"domain"`
	// 用户名称
	Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account" bson:"account"`
	// 用户类型
	UserType types.UserType `protobuf:"varint,4,opt,name=user_type,json=userType,proto3,enum=keyauth.user.UserType" json:"user_type" bson:"user_type"`
	// 用户通过哪个端登录的
	ApplicationId string `protobuf:"bytes,5,opt,name=application_id,json=applicationId,proto3" json:"application_id" bson:"application_id"`
	// 用户通过哪个端登录的
	ApplicationName string `protobuf:"bytes,6,opt,name=application_name,json=applicationName,proto3" json:"application_name" bson:"application_name"`
	// 登录方式
	GrantType token.GrantType `` /* 126-byte string literal not displayed */
	// 登录时间
	LoginAt int64 `protobuf:"varint,8,opt,name=login_at,json=loginAt,proto3" json:"login_at" bson:"login_at"`
	// 登录IP
	LoginIp string `protobuf:"bytes,9,opt,name=login_ip,json=loginIp,proto3" json:"login_ip" bson:"login_ip"`
	// 登出时间
	LogoutAt int64 `protobuf:"varint,10,opt,name=logout_at,json=logoutAt,proto3" json:"logout_at" bson:"logout_at"`
	// 应用的网站地址
	AccessToken string     `protobuf:"bytes,11,opt,name=access_token,json=accessToken,proto3" json:"access_token" bson:"access_token"`
	UserAgent   *UserAgent `protobuf:"bytes,12,opt,name=user_agent,json=userAgent,proto3" json:"user_agent" bson:"user_agent"`
	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" bson:"total"`
	Items []*Session `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// 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 UnimplementedAdminServiceServer

type UnimplementedAdminServiceServer struct {
}

UnimplementedAdminServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedAdminServiceServer) QueryUserLastSession

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) DescribeSession

func (UnimplementedUserServiceServer) Login

func (UnimplementedUserServiceServer) Logout

func (UnimplementedUserServiceServer) QuerySession

type UnsafeAdminServiceServer

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

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

type UnsafeUserServiceServer

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

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

type UserAgent

type UserAgent struct {
	Os             string `protobuf:"bytes,1,opt,name=os,proto3" json:"os" bson:"os"`
	Platform       string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform" bson:"platform"`
	EngineName     string `protobuf:"bytes,3,opt,name=engine_name,json=engineName,proto3" json:"engine_name" bson:"engine_name"`
	EngineVersion  string `protobuf:"bytes,4,opt,name=engine_version,json=engineVersion,proto3" json:"engine_version" bson:"engine_version"`
	BrowserName    string `protobuf:"bytes,5,opt,name=browser_name,json=browserName,proto3" json:"browser_name" bson:"browser_name"`
	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

type UserServiceClient

type UserServiceClient 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)
}

UserServiceClient is the client API for UserService 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.

type UserServiceServer

type UserServiceServer 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)
	// contains filtered or unexported methods
}

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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