Categorygithub.com/zvold/zvold.github.io/src/time3
modulepackage
0.6.0
Repository: https://github.com/zvold/zvold.github.io.git
Documentation: pkg.go.dev

# README

A simple time tracker, in the spirit of time management approaches like:

Usage:

  1. Start the server (see below for flags).
go run github.com/zvold/zvold.github.io/src/[email protected]
  1. Start the client(s).

Open http://hostname:37177 in the browser. Use the optional URL parameter ?t= to set the "target" work/rest ratio.

  1. Toggle the mode (work / rest / off) appropriately.

This can be done from any client. The state is maintained on the server, and clients are eventually consistent.

Refreshing the page will get the up-to-date state from the server.


The server accepts some command-line flags:

  • -port to change the HTTP port the server will listen on.

  • -https to start an additional HTTPs server on port+1. This expects SSL certificate files server.crt and server.key to be present.

  • -v to enable more verbose server logs.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

JsonRequest struct represents the body of an HTTP POST request.
*NormalClock satisfies the Clock interface.
The set of remote hosts (IP + user agent) seen during the operation.
State struct represents the full state of the punch clock.
WsClient is a mutex-protected pointer to `websocket.Conn`.
WsClients is a mutex-protected set of all connected websocket clients.

# Interfaces

Clock interface is injected for better testing.

# Type aliases

ModeType is an enum representing the possible "modes": work, rest and off.