Categorygithub.com/yonghuili1/webtail
modulepackage
1.0.1
Repository: https://github.com/yonghuili1/webtail.git
Documentation: pkg.go.dev

# README

webtail

Tail [log]files via websocket

English | Pусский


Go Reference GitHub Release Build Status GitHub license

codecov Test Coverage Maintainability GoCard

webtail is a web-service and golang package used for continious updated files publication via websocker to browser.

Ping stream sample

Install

go get -v github.com/LeKovr/webtail/...

Download binary

See Latest release

Docker

Starting from 0.43.2 docker images are published at GitHub Packages, so use

docker pull ghcr.io/lekovr/webtail:latest

See docker-compose.yml for usage example.

v0.43.1 is the last version available at dockerhub.

Use package in your service

package main
import (
    "github.com/LeKovr/webtail"
)

func main() {
    wt, err := webtail.New(log, cfg)
    if err != nil {
        return
    }
    go wt.Run()
    defer wt.Close()
    // ...
    http.Handle("/tail", wt)
}

See also: app.go

Note about gorilla/websocket

Starting from v0.30 this code is based on gorilla/websocket chat example. See {client,hub}.go

License

The MIT License (MIT), see LICENSE.

Copyright (c) 2016-2021 Aleksey Kovrizhkin [email protected]

# Packages

No description provided by the author

# Functions

FileServer return embedded or given fs.
New creates WebTail service.
NewHub creates hub for client services.
NewTailService creates tailer service.

# Constants

Returned Messages.
Returned Messages.
Returned Messages.
Returned Messages.
Returned Messages.
Returned Messages.
Returned Messages.

# Structs

Client is a middleman between the websocket connection and the hub.
Config defines local application flags.
Hub maintains the set of active clients and broadcasts messages to them.
IndexItemAttr holds File (index item) Attrs.
IndexItemEvent holds messages from indexer.
IndexMessage holds outgoing message item for file index.
InMessage holds incoming client request.
Message holds received message and sender.
Service holds WebTail service.
StatsMessage holds outgoing app stats.
TailAttr holds tail worker attributes.
TailMessage holds outgoing file tail row.
TailService holds Worker hub operations.
TraceMessage holds outgoing trace state.

# Type aliases

IndexItemAttrStore holds all index items.