xcore

package
v0.0.0-...-b68b127 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Authors        = "Md Kawser Munshi"
	Version        = "1.0.0"
	AppName        = "HypCore"
	AppNameLong    = "Hyper Core"
	AppDescription = "Hyper Core is a small reusable high performance websocket and graphql focused golang package"
)

Functions

This section is empty.

Types

type HypCore

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

func NewHypCore

func NewHypCore(hc *HypCoreConfig) *HypCore

Create new HypCore server

func (*HypCore) AddGraphQLMutationField

func (h *HypCore) AddGraphQLMutationField(name string, field *graphql.Field)

func (*HypCore) AddGraphQLQueryField

func (h *HypCore) AddGraphQLQueryField(name string, field *graphql.Field)

func (*HypCore) AddMiddleware

func (h *HypCore) AddMiddleware(mi core2.MiddlewareInterface)

func (*HypCore) AddRoute

func (h *HypCore) AddRoute(pattern string, httpHandlerObject core2.ServeHTTPInterface)

func (*HypCore) ClearKeyValueStore

func (h *HypCore) ClearKeyValueStore()

Clear key value store of context

func (*HypCore) GetContext

func (h *HypCore) GetContext() *core2.HContext

func (*HypCore) GetValue

func (h *HypCore) GetValue(key string) string

Get value using the key from the key value store of context

func (*HypCore) HasAuthVerify

func (h *HypCore) HasAuthVerify() bool

func (*HypCore) ReconfigurePath

func (h *HypCore) ReconfigurePath(webSocketUpgradePath []byte,
	graphQLPath []byte,
	livePath []byte,
	authPath []byte)

func (*HypCore) RemoveValue

func (h *HypCore) RemoveValue(key string)

Remove a value from the key value store of context

func (*HypCore) SetIsLive

func (h *HypCore) SetIsLive(live bool)

Set if the HypCore server is live or not

func (*HypCore) SetKeyValueStore

func (h *HypCore) SetKeyValueStore(dataMap map[string]string)

func (*HypCore) SetValue

func (h *HypCore) SetValue(key string, value string)

Set value in the key value store of context

func (*HypCore) Setup

func (h *HypCore) Setup()

func (*HypCore) Start

func (h *HypCore) Start()

Start HypCore server

type HypCoreConfig

type HypCoreConfig struct {
	Host                string
	Port                string
	EPollEventQueueSize int
	EPollWaitingTime    int

	EnableTLS bool
	CertFile  string
	KeyFile   string

	EnableAuthVerify bool

	EnableLivePath      bool
	EnableAuthPath      bool
	EnableGraphQLPath   bool
	EnableWebSocketPath bool

	DbPath string

	AuthBearer     string
	AuthPublicKey  string
	AuthPrivateKey string
	AuthSecretKey  string
	AuthAlgorithm  string
	AuthIssuer     string
	AuthAudiences  []string

	AuthTokenDefaultTimeout      int64
	AuthTokenSuperGroupTimeout   int64
	AuthTokenServiceGroupTimeout int64
	AuthTokenNormalGroupTimeout  int64

	AuthVerify          core2.AuthVerifyInterface
	ServeWS             core2.ServeWSInterface
	OnlineUserDataStore core2.OnlineUserDataStoreInterface
	StorageEngine       core2.StorageInterface

	// If set, all origins are allowed.
	CORSAllowAllOrigins bool
	// A list of allowed origins. Wild cards and FQDNs are supported.
	CORSAllowOrigins []string
	// If set, allows to share auth credentials such as cookies.
	CORSAllowCredentials bool
	// A list of allowed HTTP methods.
	CORSAllowMethods []string
	// A list of allowed HTTP headers.
	CORSAllowHeaders []string
	// A list of exposed HTTP headers.
	CORSExposeHeaders []string
	// Max age of the CORS headers.
	CORSMaxAge time.Duration
}

Jump to

Keyboard shortcuts

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