Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LuaPool = lualib.NewLuaStatePool()
LuaPool is a pool of Lua state instances.
var ( // RequestChan is a buffered channel of type `*Action` used to send action requests to a worker. RequestChan chan *Action )
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { // LuaAction stores the user's desired action in Lua format. LuaAction global.LuaAction // Debug is a flag indicating if the action is executed in debug mode. Debug bool // Repeating is a flag indicating if the action would be repeated. Repeating bool // UserFound is a flag indicating if the user executing the action was found in the system. UserFound bool // Authenticated is a flag indicating if the user is authenticated. Authenticated bool // NoAuth is a flag indicating if the action requires no authentication. NoAuth bool // BruteForceCounter keeps track of unsuccessful login attempts for the user. BruteForceCounter uint // Session stores the unique session identifier. Session string // GUID // ClientIP stores the IP address of the client. ClientIP string // ClientPort stores the port number used by the client. ClientPort string // ClientNet stores the network used by the client. ClientNet string // ClientHost stores the hostname of the client. ClientHost string // ClientID stores the unique identifier for the client. ClientID string // LocalIP stores the IP address of the local machine. LocalIP string // LocalPort stores the port number used by the local machine. LocalPort string // Username stores the username of the user that was used to authenticate. Username string // Account stores the user's account information. Account string // UniqueUserID stores the unique user identifier. UniqueUserID string // DisplayName stores the user's display name. DisplayName string // Password stores the user's password. Password string // Protocol stores the protocol that the user used to authenticate. Protocol string // BruteForceName stores the name of the brute force protection mechanism. BruteForceName string // FeatureName is a feature that triggered the action. FeatureName string // XSSL contains SSL information. XSSL string // XSSLSessionID is the SSL session identifier. XSSLSessionID string // XSSLClientVerify indicates whether SSL client is verified. XSSLClientVerify string // XSSLClientDN is the client's Distinguished Name in the SSL certificate. XSSLClientDN string // XSSLClientCN is the client's Common Name in the SSL certificate. XSSLClientCN string // XSSLIssuer is the issuer of the SSL certificate. XSSLIssuer string // XSSLClientNotBefore is the date before which the SSL certificate is not valid. XSSLClientNotBefore string // XSSLClientNotAfter is the date after which the SSL certificate is not valid. XSSLClientNotAfter string // XSSLSubjectDN is the Subject's Distinguished Name in the SSL certificate. XSSLSubjectDN string // XSSLIssuerDN is the Issuer's Distinguished Name in the SSL certificate. XSSLIssuerDN string // XSSLClientSubjectDN is the client's Subject Distinguished Name in the SSL certificate. XSSLClientSubjectDN string // XSSLClientIssuerDN is the client's Issuer Distinguished Name in the SSL certificate. XSSLClientIssuerDN string // XSSLProtocol is the SSL protocol used. XSSLProtocol string // XSSLCipher is the encryption cipher used in the SSL protocol. XSSLCipher string // Context represents the shared Lua context which is used by all Lua states accross the request. *lualib.Context // FinishedChan is a channel signaling the completion of the action. FinishedChan chan Done }
Action contains a subset of the Authentication structure. Action represents all the information related to a user's action in the system.
type Done ¶
type Done struct{}
Done is an empty struct that can be used to signal the completion of a task or operation.
type LuaScriptAction ¶
type LuaScriptAction struct { // ScriptPath is the path to the Lua script file. ScriptPath string // ScriptCompiled is the compiled Lua function. ScriptCompiled *lua.FunctionProto // LuaAction is the type of Lua action. LuaAction global.LuaAction }
LuaScriptAction represents an action that can be executed using Lua script.
type Worker ¶
type Worker struct { // DoneChan is a buffered channel of type `Done` used to signal the end of a worker. DoneChan chan Done // contains filtered or unexported fields }
Worker struct holds the data required for a worker process.
func NewWorker ¶
func NewWorker() *Worker
NewWorker creates a new instance of the Worker struct. It initializes a resultMap map with two key-value pairs. It initializes a RequestChan channel with a maximum size of MaxChannelSize. It returns a pointer to the newly created Worker.
func (*Worker) Work ¶
Work executes the worker logic in a continuous loop. It loads action scripts from the configuration and then waits for requests or context cancellation. If a request is received, it handles the request by running the corresponding script. If the context is cancelled, it sends a WorkerEndChan signal to indicate that the worker has ended.