Documentation
¶
Index ¶
- Constants
- Variables
- func AppendGeneralInfo(lines *[]LineResult)
- func BindRequest[T any](c echo.Context, request T) error
- func CleanString(input string) string
- func Cleanup()
- func ConsistentFormat(logLines []string) (bool, int)
- func ContainerStdoutToTmp(containerID string) *os.File
- func F64NumberToK(num *float64) string
- func FilePathInGlobalFilePaths(filePath string) bool
- func FileStats(filePath string, isRemote bool, sshConfig *SSHConfig) (int, int64, error)
- func FilesByPattern(pattern string, isRemote bool, sshConfig *SSHConfig) ([]string, error)
- func GetHomedir() string
- func GetTmpFileNameForContainer() string
- func GetTmpFileNameForSTDIN() string
- func HTTPErrorHandler(err error, c echo.Context)
- func HandleCltrC(f func())
- func HandleStdinPipe()
- func IsGzip(buffer []byte) bool
- func IsInputFromPipe() bool
- func IsReadableFile(filename string, isRemote bool, sshConfig *SSHConfig, checkUTF8 bool) (bool, error)
- func JudgeLogLevel(line string, keywordPosition int) string
- func ListDockerContainers() ([]types.Container, error)
- func NewEcho(opts ...EchoOption) error
- func NewOrReusableClient(config *SSHConfig) (*ssh.Client, error)
- func NewSession(config *SSHConfig) (*ssh.Session, error)
- func OpenBrowser(url string)
- func PipeLinesToTmp(tmpFile *os.File) error
- func ResponseHTML(c echo.Context, b []byte, cacheMS string) error
- func ResponsePlain(c echo.Context, b []byte, cacheMS string) error
- func SetHeadersResponseHTML(header http.Header, cacheMS string)
- func SetHeadersResponseJSON(header http.Header)
- func SetHeadersResponsePNG(header http.Header)
- func SetHeadersResponsePlainText(header http.Header, cacheMS string)
- func SetHeadersResponseSvg(header http.Header)
- func SetupCors(e *echo.Echo, options *EchoOptions)
- func SetupLoggingStdout(logLevel slog.Leveler)
- func SetupMiddlewares(e *echo.Echo)
- func SetupRoutes(e *echo.Echo, options *EchoOptions)
- func StringInSlice(s string, ss []string) bool
- func UpdateGlobalFilePaths(filePaths SliceFlags, sshPaths SliceFlags, dockerPaths SliceFlags, limit int)
- func WatchFilePaths(seconds int64, filePaths SliceFlags, sshPaths SliceFlags, ...)
- type API
- type APIHandler
- type APIRequest
- type APIResponse
- type AssetsHandler
- type DockerPathConfig
- type EchoOption
- type EchoOptions
- type FileInfo
- type HTTPErrorResponse
- type LineResult
- type SSHConfig
- type SSHPathConfig
- type ScanResult
- type SliceFlags
- type ValidationErrs
- type Watcher
Constants ¶
const ( TypeFile = "file" TypeStdin = "stdin" TypeSSH = "ssh" TypeDocker = "docker" TmpStdinPath = "/tmp/GOL-STDIN-" TmpContainerPath = "/tmp/GOL-CONTAINER-" ErrorMsgSessionAlreadyStarted = "ssh: session already started" )
Variables ¶
var GlobalFilePaths []FileInfo
var GlobalPathSSHConfig []SSHPathConfig
var GlobalPipeTmpFilePath string
var GlobalSSHClients = make(map[string]*ssh.Client)
Functions ¶
func AppendGeneralInfo ¶ added in v1.0.22
func AppendGeneralInfo(lines *[]LineResult)
func BindRequest ¶
func CleanString ¶ added in v1.0.7
CleanString removes non-printable characters from a string
func ConsistentFormat ¶
ConsistentFormat checks if all log lines have log levels at the same position
func ContainerStdoutToTmp ¶ added in v1.0.7
func F64NumberToK ¶ added in v1.0.4
func FilePathInGlobalFilePaths ¶ added in v1.0.4
func FileStats ¶ added in v1.0.4
FileStats returns the number of lines and size of the file at the given path.
func FilesByPattern ¶
func GetHomedir ¶
func GetHomedir() string
func GetTmpFileNameForContainer ¶ added in v1.0.7
func GetTmpFileNameForContainer() string
func GetTmpFileNameForSTDIN ¶ added in v1.0.7
func GetTmpFileNameForSTDIN() string
func HTTPErrorHandler ¶
func HTTPErrorHandler(err error, c echo.Context)
HTTPErrorHandler handles HTTP errors for entire application
func HandleCltrC ¶ added in v1.0.4
func HandleCltrC(f func())
func HandleStdinPipe ¶ added in v1.0.26
func HandleStdinPipe()
func IsInputFromPipe ¶ added in v1.0.3
func IsInputFromPipe() bool
IsInputFromPipe checks if there is input from a pipe
func IsReadableFile ¶
func IsReadableFile(filename string, isRemote bool, sshConfig *SSHConfig, checkUTF8 bool) (bool, error)
IsReadableFile checks if the file is readable and optionally checks for valid UTF-8 encoded content
func JudgeLogLevel ¶
JudgeLogLevel returns the log level based on the content of the log line if the format is consistent
func ListDockerContainers ¶ added in v1.0.7
func NewEcho ¶
func NewEcho(opts ...EchoOption) error
func NewOrReusableClient ¶ added in v1.0.20
func OpenBrowser ¶ added in v1.0.3
func OpenBrowser(url string)
func PipeLinesToTmp ¶ added in v1.0.4
func ResponseHTML ¶
func ResponsePlain ¶
func SetHeadersResponseHTML ¶
func SetHeadersResponseJSON ¶
func SetHeadersResponsePNG ¶
func SetHeadersResponseSvg ¶
func SetupCors ¶
func SetupCors(e *echo.Echo, options *EchoOptions)
func SetupLoggingStdout ¶ added in v1.0.21
func SetupMiddlewares ¶
func SetupMiddlewares(e *echo.Echo)
func SetupRoutes ¶
func SetupRoutes(e *echo.Echo, options *EchoOptions)
func StringInSlice ¶
func UpdateGlobalFilePaths ¶ added in v1.0.26
func UpdateGlobalFilePaths(filePaths SliceFlags, sshPaths SliceFlags, dockerPaths SliceFlags, limit int)
func WatchFilePaths ¶ added in v1.0.26
func WatchFilePaths(seconds int64, filePaths SliceFlags, sshPaths SliceFlags, dockerPaths SliceFlags, limit int)
Types ¶
type API ¶ added in v1.0.5
type API struct { }
func (*API) FindSSHConfig ¶ added in v1.0.5
func (a *API) FindSSHConfig(host string) *SSHPathConfig
type APIHandler ¶
type APIHandler struct {
API *API
}
func NewAPIHandler ¶
func NewAPIHandler() *APIHandler
func (*APIHandler) Get ¶
func (h *APIHandler) Get(c echo.Context) error
type APIRequest ¶
type APIRequest struct { Query string `json:"query" query:"query"` Ignore string `json:"ignore" query:"ignore"` FilePath string `json:"file_path" query:"file_path"` Host string `json:"host" query:"host"` Type string `json:"type" query:"type"` Page int `json:"page" query:"page" default:"1" validate:"required,gte=1" message:"page >=1 is required"` PerPage int `json:"per_page" query:"per_page" default:"15" validate:"required" message:"per_page is required"` Reverse bool `json:"reverse" query:"reverse" default:"false"` }
type APIResponse ¶
type APIResponse struct { Result ScanResult `json:"result"` FilePaths []FileInfo `json:"file_paths"` }
type AssetsHandler ¶
type AssetsHandler struct {
// contains filtered or unexported fields
}
func NewAssetsHandler ¶
func NewAssetsHandler(publicDir *embed.FS, distDir string, filename string) *AssetsHandler
func (*AssetsHandler) Get ¶ added in v1.0.26
func (h *AssetsHandler) Get(c echo.Context) error
func (*AssetsHandler) GetICO ¶
func (h *AssetsHandler) GetICO(c echo.Context) error
func (*AssetsHandler) GetPlain ¶
func (h *AssetsHandler) GetPlain(c echo.Context) error
type DockerPathConfig ¶ added in v1.0.7
func StringToDockerPathConfig ¶ added in v1.0.7
func StringToDockerPathConfig(s string) (*DockerPathConfig, error)
s is an input of the form "container_id /path/to/file"
type EchoOption ¶
type EchoOption func(*EchoOptions) error
type EchoOptions ¶
type FileInfo ¶ added in v1.0.4
type FileInfo struct { FilePath string `json:"file_path"` LinesCount int `json:"lines_count"` FileSize int64 `json:"file_size"` Name string `json:"name"` Type string `json:"type"` Host string `json:"host"` }
func GetContainerFileInfos ¶ added in v1.0.7
func GetFileInfos ¶ added in v1.0.4
func UniqueFileInfos ¶ added in v1.0.26
type HTTPErrorResponse ¶
type HTTPErrorResponse struct {
Error interface{} `json:"error"`
}
HTTPErrorResponse is the response for HTTP errors
type LineResult ¶
type SSHPathConfig ¶ added in v1.0.5
type SSHPathConfig struct { Host string Port string User string Password string PrivateKeyPath string FilePath string }
func StringToSSHPathConfig ¶ added in v1.0.5
func StringToSSHPathConfig(s string) (*SSHPathConfig, error)
s is an input of the form "user@host[:port] [password=/path/to/password] [private_key=/path/to/key] /path/to/file"
type ScanResult ¶
type ScanResult struct { FilePath string `json:"file_path"` Host string `json:"host"` Type string `json:"type"` MatchPattern string `json:"match_pattern"` Total int `json:"total"` Lines []LineResult `json:"lines"` }
func ContainerLogsFromFile ¶ added in v1.0.7
type SliceFlags ¶ added in v1.0.26
type SliceFlags []string
func (*SliceFlags) Set ¶ added in v1.0.26
func (i *SliceFlags) Set(value string) error
provide a Set() method on the type so we can use it with flag.Var
func (*SliceFlags) String ¶ added in v1.0.26
func (i *SliceFlags) String() string
provide a String() method on the type so we can use it with flag.Var
type ValidationErrs ¶
func ValidateRequest ¶
func ValidateRequest[T any](request T) (ValidationErrs, error)