gf_rpc_lib

package
v0.0.0-...-a1b0e2b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-2.0 Imports: 19 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientRequest

func ClientRequest(pURLstr string,
	pHeadersMap map[string]string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (map[string]interface{}, *gf_core.GFerror)

func ClientRequestSSE

func ClientRequestSSE(pURLstr string,
	pRespDataCh chan (map[string]interface{}),
	pHeadersMap map[string]string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func CreateHandlerHTTP

func CreateHandlerHTTP(pPathStr string,
	pHandlerFun gf_core.HTTPhandler,
	pRuntimeSys *gf_core.RuntimeSys)

func CreateHandlerHTTPwithAuth

func CreateHandlerHTTPwithAuth(pAuthBool bool,
	pPathStr string,
	pHandlerFun gf_core.HTTPhandler,
	pHandlerRuntime *GFrpcHandlerRuntime,
	pRuntimeSys *gf_core.RuntimeSys)

func CreateHandlerHTTPwithMetrics

func CreateHandlerHTTPwithMetrics(pPathStr string,
	pHandlerFun gf_core.HTTPhandler,
	pMetrics *GF_metrics,
	pStoreRunBool bool,
	pRuntimeSys *gf_core.RuntimeSys)

func CreateHandlerHTTPwithMux

func CreateHandlerHTTPwithMux(pPathStr string,
	pHandlerFun gf_core.HTTPhandler,
	pMux *http.ServeMux,
	pMetrics *GF_metrics,
	pStoreRunBool bool,
	pSentryHub *sentry.Hub,
	pRuntimeSys *gf_core.RuntimeSys)

func CreateHandlerSSE

func CreateHandlerSSE(pPathStr string,
	pHandlerFun handler_http_sse,
	pStoreRunBool bool,
	pRuntimeSys *gf_core.RuntimeSys)

func CreateHandlersHTTP

func CreateHandlersHTTP(pMetricsGroupNameStr string,
	pHandlersLst []gf_core.HTTPhandlerInfo,
	pHTTPmux *http.ServeMux,
	pAuthSubsystemTypeStr string,
	pAuthLoginURLstr string,
	pKeyServer *gf_identity_core.GFkeyServerInfo,
	pRuntimeSys *gf_core.RuntimeSys)

func ErrorInHandler

func ErrorInHandler(p_handler_url_path_str string,
	p_user_msg_str string,
	p_gf_err *gf_core.GFerror,
	p_resp http.ResponseWriter,
	pRuntimeSys *gf_core.RuntimeSys)

func GetResponseFormat

func GetResponseFormat(p_qs_map map[string][]string,
	pRuntimeSys *gf_core.RuntimeSys) string

func HTTPcorsPreflightHandle

func HTTPcorsPreflightHandle(p_req *http.Request,
	p_resp http.ResponseWriter)

func HTTPrespond

func HTTPrespond(p_data interface{},
	p_status_str string,
	p_resp http.ResponseWriter,
	pRuntimeSys *gf_core.RuntimeSys)

func MMSinitHandlers

func MMSinitHandlers(pServerInfo GFmmsServerInfo,
	pHTTPmutex *http.ServeMux,
	pRuntimeSys *gf_core.RuntimeSys)

func MMSsessioJoin

func MMSsessioJoin(pUserNameStr string,
	pMetaMap map[string]interface{},
	pSession *GFmmsSession,
	pServerInfo GFmmsServerInfo,
	pRuntimeSys *gf_core.RuntimeSys) (int, map[string]interface{})

func MMSsessionReset

func MMSsessionReset(pSessionNameStr string,
	pUserNameStr string,
	pSession *GFmmsSession,
	pRuntimeSys *gf_core.RuntimeSys)

func ServerInit

func ServerInit(pServerNameStr string,
	pPortInt int)

func ServerInitWithMux

func ServerInitWithMux(pServerNameStr string,
	pPortInt int,
	pMux *http.ServeMux)

func StoreRPChandlerRun

func StoreRPChandlerRun(pHandlerURLstr string,
	pStartTimeUNIXf float64,
	pEndTimeUNIXf float64,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func UDPlistenForPackets

func UDPlistenForPackets(pExternalIPtoUseStr string,
	pPortStr string,
	pRuntimeSys *gf_core.RuntimeSys) (*net.UDPConn, *gf_core.GFerror)

func UDPsendObjUpdateToAllClients

func UDPsendObjUpdateToAllClients(pPacketDataLst []byte,
	pUpdateOriginatorClientCompositeKeyStr string,
	pClientsTableMap map[string]GFudpClient,
	pConnExt *net.UDPConn,
	pServerDef GFudpServerDef,
	pRuntimeSys *gf_core.RuntimeSys)

func UDPsendRegistrationConfirmation

func UDPsendRegistrationConfirmation(pUDPaddressOfSender *net.UDPAddr,
	pConnExt *net.UDPConn,
	pServerDef GFudpServerDef,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func UDPstartListening

func UDPstartListening(pServerDef GFudpServerDef,
	pRuntimeSys *gf_core.RuntimeSys)

Types

type GF_metrics

type GF_metrics struct {
	HandlersCountersMap map[string]prometheus.Counter

	// AUTH_SESSION_INVALID - counter for when auth session validation fails when
	//                        request is received and validated
	HandlersAuthSessionInvalidCounter prometheus.Counter
}

func MetricsCreateForHandlers

func MetricsCreateForHandlers(pMetricsGroupNameStr string,
	pServiceNameStr string,
	pHandlersEndpointsLst []string) *GF_metrics

type GFmmsOnSessionJoinFun

type GFmmsOnSessionJoinFun func(*GFmmsSession, map[string]interface{}) map[string]interface{}

type GFmmsOnSessionStatusFun

type GFmmsOnSessionStatusFun func(*GFmmsSession, map[string]interface{}) map[string]interface{}

type GFmmsServerInfo

type GFmmsServerInfo struct {
	ClientsJoinedThresholdInt int // number of clients that are expected to join the session at a minimum
	OnSessionJoinFun          GFmmsOnSessionJoinFun
	OnSessionStatusFun        GFmmsOnSessionStatusFun
}

SERVER_INFO

type GFmmsSession

type GFmmsSession struct {
	IDstr                     string
	ClientsJoinedThresholdInt int // number of clients that are expected to join the session at a minimum
	ClientsJoinedLst          []int
	ClientNextAvailableIDint  int
	ClientsCountInt           int
}

SESSION

func MMSsessionGetOrCreate

func MMSsessionGetOrCreate(pNameStr string,
	pSessionMap map[string]*GFmmsSession,
	pServerInfo GFmmsServerInfo) *GFmmsSession

type GFmmsSessionStatus

type GFmmsSessionStatus struct {
	StatusStr                 string // "waiting" | "started"
	ClientsJoinedThresholdInt int
	ClientsJoinedLst          []int
	ClientsCountInt           int

	// arbtirary metadata that this servrs callbacks can attach to sessions
	SessionMetaMap map[string]interface{}
}

SESSION_STATUS

func MMSsessionStatus

func MMSsessionStatus(pReqMetaMap map[string]interface{},
	pSession *GFmmsSession,
	pServerInfo GFmmsServerInfo,
	pRuntimeSys *gf_core.RuntimeSys) *GFmmsSessionStatus

type GFrpcHandlerRun

type GFrpcHandlerRun struct {
	ClassStr       string  `bson:"class_str"`
	HandlerURLstr  string  `bson:"handler_url_str"`
	StartTimeUNIXf float64 `bson:"start_time__unix_f"`
	EndTimeUNIXf   float64 `bson:"endTimeUNIXf"`
}

type GFrpcHandlerRuntime

type GFrpcHandlerRuntime struct {
	Mux          *http.ServeMux
	Metrics      *GF_metrics
	StoreRunBool bool
	SentryHub    *sentry.Hub

	AuthSubsystemTypeStr string
	AuthLoginURLstr      string // url redirected too if user not logged in and tries to access auth handler
	AuthKeyServer        *gf_identity_core.GFkeyServerInfo
}

type GFudpClient

type GFudpClient struct {
	IDint   int
	IPstr   string
	PortInt int
	Address *net.UDPAddr
}

type GFudpServerDef

type GFudpServerDef struct {
	ExternalIPtoUseStr string
	PortStr            string

	// unique package pattern for the defined server that allows clients
	// to register with this server
	RegistrationPacketLst             []byte
	RegistrationConfirmationPacketLst []byte

	// object headers to sync across connected clients
	ObjectsToSyncLst []PacketHeaderObjUpdate
}

type PacketHeaderObjUpdate

type PacketHeaderObjUpdate []byte

type SSE_data_complete_ch

type SSE_data_complete_ch chan bool

type SSE_data_err_ch

type SSE_data_err_ch chan gf_core.GFerror

type SSE_data_update_ch

type SSE_data_update_ch chan interface{}

Jump to

Keyboard shortcuts

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