hsrv

package
v0.0.0-...-2b26f38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

README

HTTPS Server

Serves two patterns:

  1. /checkin/{id} IDs checkin
  2. Everything else is a static file

Documentation

Overview

Package hsrv - HTTPS Server part of loweffortbotnetcontroller

Index

Constants

View Source
const (
	CheckInPattern = "/checkin/{id}"
)

CheckInPattern is the URL pattern used for checkins.

View Source
const Timeout = 2 * time.Second

Timeout is a generic Read and Write timeout for all things HTTP.

Variables

This section is empty.

Functions

func Fingerprint

func Fingerprint(certFile string) (string, error)

Fingerprint returns the TLS cert's fingerprint. It does this by listening very briefly for TLS connections, to be as close as possible to how Serve generates a cert. Pass in the same certFile that is passed to Serve.

func Serve

func Serve(
	ctx context.Context,
	sl *slog.Logger,
	addr string,
	certFile string,
	filesDir string,
	idm *idmanager.Manager,
	checkInDir string,
	callbackString string,
	maxBody int64,
) error

Serve serves HTTPS requests on the given address. Requests for /checkin are handled with files in checkInDir as well as with the IDManager. All other requests serve files from filesDir.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL