KaguyaKernel

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

README

Kaguya Kernel

The opensource instant messaging framework.

logo

License

    Copyright 2021 Star Inc.(https://starinc.xyz)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

Documentation

Overview

Package KaguyaKernel: The opensource instant messaging framework.

Copyright 2021 Star Inc.(https://starinc.xyz)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Index

Constants

View Source
const (
	ErrorJSONDecodingRequest = "JSON_decoding_request_error"
	ErrorInvalidRequestType  = "Request_type_is_invalid"
)
View Source
const (
	ErrorJSONEncodingResponseData = "JSON_encoding_response_data_error"
	ErrorJSONEncodingResponse     = "JSON_encoding_response_error"
	ErrorGenerateSignature        = "Generate_signature_error"
	ErrorSessionClosed            = "Session_closed_error"
)
View Source
const ErrorForbidden = "Forbidden"

Variables

This section is empty.

Functions

func Run

func Run(service ServiceInterface, guard AuthorizeInterface, requestSalt string) *melody.Melody

Types

type AuthorizeInterface

type AuthorizeInterface interface {
	Me() string
	Permission(target string) bool
}

type ErrorReport

type ErrorReport struct {
	Error     string `json:"error"`
	Timestamp int64  `json:"timestamp"`
}

type Request

type Request struct {
	Data interface{} `json:"data"`
	Type string      `json:"type"`
}

type Response

type Response struct {
	Data      interface{} `json:"data"`
	Signature string      `json:"signature"`
	Timestamp int64       `json:"timestamp"`
}

type RethinkConfig

type RethinkConfig struct {
	ConnectConfig Rethink.ConnectOpts
	DatabaseName  string
}

type Service

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

func (*Service) CheckRequestType

func (service *Service) CheckRequestType(method reflect.Value) bool

func (*Service) GetGuard

func (service *Service) GetGuard() AuthorizeInterface

func (*Service) GetSession

func (service *Service) GetSession() *Session

func (*Service) SetGuard

func (service *Service) SetGuard(authorization AuthorizeInterface)

func (*Service) SetSession

func (service *Service) SetSession(session *Session)

type ServiceInterface

type ServiceInterface interface {
	Fetch(context.Context)
	CheckPermission() bool
	GetGuard() AuthorizeInterface
	SetGuard(authorization AuthorizeInterface)
	GetSession() *Session
	SetSession(session *Session)
	CheckRequestType(method reflect.Value) bool
}

type Session

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

func NewSession

func NewSession(socketSession *melody.Session, requestSalt string) *Session

func (*Session) RaiseError

func (session *Session) RaiseError(message string)

func (*Session) Response

func (session *Session) Response(data interface{})

type Signature

type Signature struct {
	Data      interface{} `json:"data"`
	Salt      string      `json:"salt"`
	Timestamp int64       `json:"timestamp"`
}

Directories

Path Synopsis
service
box

Jump to

Keyboard shortcuts

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