Documentation ¶
Overview ¶
Package vplugin contains the generic and externalized plugin interface for PAM. This allows closed source implementations to be used with valkyrie as plugins.
Index ¶
- Constants
- Variables
- func NewZerologAdapter() *zerologAdapter
- func RegisterGobs()
- type PAM
- type PluginControl
- type PluginInitConfig
- type PluginPAM
- func (vp *PluginPAM) AddTransaction(rm pam.AddTransactionRequestMapper) (*pam.TransactionResult, error)
- func (vp *PluginPAM) GetBalance(rm pam.GetBalanceRequestMapper) (*pam.Balance, error)
- func (vp *PluginPAM) GetGameRound(rm pam.GetGameRoundRequestMapper) (*pam.GameRound, error)
- func (vp *PluginPAM) GetSession(rm pam.GetSessionRequestMapper) (*pam.Session, error)
- func (vp *PluginPAM) GetTransactionSupplier() pam.TransactionSupplier
- func (vp *PluginPAM) GetTransactions(rm pam.GetTransactionsRequestMapper) ([]pam.Transaction, error)
- func (vp *PluginPAM) RefreshSession(rm pam.RefreshSessionRequestMapper) (*pam.Session, error)
- type VPlugin
- type VPluginRPC
- func (vp *VPluginRPC) AddTransaction(req pam.AddTransactionRequest) *pam.AddTransactionResponse
- func (vp *VPluginRPC) GetBalance(req pam.GetBalanceRequest) *pam.BalanceResponse
- func (vp *VPluginRPC) GetGameRound(req pam.GetGameRoundRequest) *pam.GameRoundResponse
- func (vp *VPluginRPC) GetSession(req pam.GetSessionRequest) *pam.SessionResponse
- func (vp *VPluginRPC) GetTransactionSupplier() pam.TransactionSupplier
- func (vp *VPluginRPC) GetTransactions(req pam.GetTransactionsRequest) *pam.GetTransactionsResponse
- func (vp *VPluginRPC) Init(cfg PluginInitConfig) error
- func (vp *VPluginRPC) RefreshSession(req pam.RefreshSessionRequest) *pam.SessionResponse
- type VPluginRPCServer
- func (pp *VPluginRPCServer) AddTransaction(args any, resp *pam.AddTransactionResponse) error
- func (pp *VPluginRPCServer) GetBalance(args any, response *pam.BalanceResponse) error
- func (pp *VPluginRPCServer) GetGameRound(args any, resp *pam.GameRoundResponse) error
- func (pp *VPluginRPCServer) GetSession(args any, resp *pam.SessionResponse) error
- func (pp *VPluginRPCServer) GetTransactionSupplier(args any, resp *pam.TransactionSupplier) error
- func (pp *VPluginRPCServer) GetTransactions(args any, resp *pam.GetTransactionsResponse) error
- func (pp *VPluginRPCServer) Init(args any, resp *any) error
- func (pp *VPluginRPCServer) RefreshSession(args any, resp *pam.SessionResponse) error
Constants ¶
View Source
const ( RPCSystem = "net/rpc" RPCService = "vplugin.PluginPAM" )
Variables ¶
View Source
var ( MagicCookieKey = "BASIC_VPLUGIN" // MagicCookieValue is not sensitive, it's used to do a basic handshake between // a plugin and host. If the handshake fails, a user-friendly error is shown. // It is a UX feature, not a security feature. MagicCookieValue = "ff912fb194609a432cfe8d504951f133a0a21b18" )
View Source
var PluginConfig func(string, string) plugin.ClientConfig = func(name, path string) plugin.ClientConfig { return plugin.ClientConfig{ HandshakeConfig: plugin.HandshakeConfig{ ProtocolVersion: 1, MagicCookieKey: MagicCookieKey, MagicCookieValue: MagicCookieValue, }, Plugins: map[string]plugin.Plugin{ name: &VPlugin{}, }, Cmd: exec.Command(path), Logger: NewZerologAdapter(), } }
Functions ¶
func NewZerologAdapter ¶ added in v0.4.0
func NewZerologAdapter() *zerologAdapter
func RegisterGobs ¶
func RegisterGobs()
Types ¶
type PAM ¶
type PAM interface { // GetSession Return session GetSession(pam.GetSessionRequest) *pam.SessionResponse // RefreshSession returns a new session token RefreshSession(pam.RefreshSessionRequest) *pam.SessionResponse // GetBalance get balance from PAM GetBalance(pam.GetBalanceRequest) *pam.BalanceResponse // GetTransactions get transactions from pam GetTransactions(pam.GetTransactionsRequest) *pam.GetTransactionsResponse // AddTransaction returns transactionId and balance. When transaction fails balance // can still be returned. On failure error will be returned AddTransaction(pam.AddTransactionRequest) *pam.AddTransactionResponse // GetGameRound gets gameRound from PAM GetGameRound(pam.GetGameRoundRequest) *pam.GameRoundResponse // GetTransactionSupplier return the type of transaction supplier the PAM supports GetTransactionSupplier() pam.TransactionSupplier PluginControl }
PamClient Interface describing available PAM operations. The implementing plugins are expected to fulfill this interface.
type PluginControl ¶
type PluginControl interface { // Init passes configuration to plugins which are expected to report // any startup issues as errors. Init(PluginInitConfig) error }
type PluginInitConfig ¶
PluginInitConfig is passed to the plugin at startup
type PluginPAM ¶ added in v0.5.0
type PluginPAM struct {
// contains filtered or unexported fields
}
func (*PluginPAM) AddTransaction ¶ added in v0.5.0
func (vp *PluginPAM) AddTransaction(rm pam.AddTransactionRequestMapper) (*pam.TransactionResult, error)
func (*PluginPAM) GetBalance ¶ added in v0.5.0
func (*PluginPAM) GetGameRound ¶ added in v0.5.0
func (*PluginPAM) GetSession ¶ added in v0.5.0
func (*PluginPAM) GetTransactionSupplier ¶ added in v0.6.0
func (vp *PluginPAM) GetTransactionSupplier() pam.TransactionSupplier
func (*PluginPAM) GetTransactions ¶ added in v0.5.0
func (vp *PluginPAM) GetTransactions(rm pam.GetTransactionsRequestMapper) ([]pam.Transaction, error)
func (*PluginPAM) RefreshSession ¶ added in v0.5.0
type VPlugin ¶
type VPlugin struct {
Impl PAM
}
type VPluginRPC ¶ added in v0.5.0
type VPluginRPC struct {
// contains filtered or unexported fields
}
func (*VPluginRPC) AddTransaction ¶ added in v0.5.0
func (vp *VPluginRPC) AddTransaction(req pam.AddTransactionRequest) *pam.AddTransactionResponse
func (*VPluginRPC) GetBalance ¶ added in v0.5.0
func (vp *VPluginRPC) GetBalance(req pam.GetBalanceRequest) *pam.BalanceResponse
func (*VPluginRPC) GetGameRound ¶ added in v0.5.0
func (vp *VPluginRPC) GetGameRound(req pam.GetGameRoundRequest) *pam.GameRoundResponse
func (*VPluginRPC) GetSession ¶ added in v0.5.0
func (vp *VPluginRPC) GetSession(req pam.GetSessionRequest) *pam.SessionResponse
func (*VPluginRPC) GetTransactionSupplier ¶ added in v0.6.0
func (vp *VPluginRPC) GetTransactionSupplier() pam.TransactionSupplier
func (*VPluginRPC) GetTransactions ¶ added in v0.5.0
func (vp *VPluginRPC) GetTransactions(req pam.GetTransactionsRequest) *pam.GetTransactionsResponse
func (*VPluginRPC) Init ¶ added in v0.5.0
func (vp *VPluginRPC) Init(cfg PluginInitConfig) error
func (*VPluginRPC) RefreshSession ¶ added in v0.5.0
func (vp *VPluginRPC) RefreshSession(req pam.RefreshSessionRequest) *pam.SessionResponse
type VPluginRPCServer ¶ added in v0.5.0
type VPluginRPCServer struct {
Impl PAM
}
func (*VPluginRPCServer) AddTransaction ¶ added in v0.5.0
func (pp *VPluginRPCServer) AddTransaction(args any, resp *pam.AddTransactionResponse) error
func (*VPluginRPCServer) GetBalance ¶ added in v0.5.0
func (pp *VPluginRPCServer) GetBalance(args any, response *pam.BalanceResponse) error
func (*VPluginRPCServer) GetGameRound ¶ added in v0.5.0
func (pp *VPluginRPCServer) GetGameRound(args any, resp *pam.GameRoundResponse) error
func (*VPluginRPCServer) GetSession ¶ added in v0.5.0
func (pp *VPluginRPCServer) GetSession(args any, resp *pam.SessionResponse) error
func (*VPluginRPCServer) GetTransactionSupplier ¶ added in v0.6.0
func (pp *VPluginRPCServer) GetTransactionSupplier(args any, resp *pam.TransactionSupplier) error
func (*VPluginRPCServer) GetTransactions ¶ added in v0.5.0
func (pp *VPluginRPCServer) GetTransactions(args any, resp *pam.GetTransactionsResponse) error
func (*VPluginRPCServer) Init ¶ added in v0.5.0
func (pp *VPluginRPCServer) Init(args any, resp *any) error
func (*VPluginRPCServer) RefreshSession ¶ added in v0.5.0
func (pp *VPluginRPCServer) RefreshSession(args any, resp *pam.SessionResponse) error
Click to show internal directories.
Click to hide internal directories.