For efficiency and security we support use of a unix socket, but tcp can be used instead. In the case of TCP, the server will listen on 127.1 by default but can be configured to listen on a different address and port. In any case, it is highly recommended to run the server behind a reverse proxy supporting HTTPS such as nginx or caddy.
Before main execution, both the server and client check for a version command line argument. If it is present, the program will print the version and exit.
First, we make sure a token is provisioned. In the future we will use the system keyring.
Then we can start the web server and listen for websocket connections.
``` go
--- entrypoint
func main(){
@{handle version command}
tokenBase64, _ := auth.ProvisionToken()
if len(tokenBase64) > 0 {
fmt.Println("This is your authentication token, it will only be shown once: " + tokenBase64)