nex

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package nex provides nex station (server) and client functionality.

For more information about nex, see https://nightfall.city/nex/info/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response added in v0.0.7

type Response struct {
	Raw  io.Reader
	Conn net.Conn
}

A Response represents a response from a nex station. It implements the io.Reader interface.

func Request added in v0.0.7

func Request(ctx context.Context, rawURL string) (*Response, error)

Request makes a nex request to rawURL.

func (*Response) Read added in v0.0.7

func (r *Response) Read(b []byte) (int, error)

Read reads up to len(b) bytes into b.

type Station

type Station struct {
	FS        fs.FS
	Nocturnal bool
	Latitude  float64
}

A Station serves content from FS. Only open at night if Nocturnal is true. Uses Latitude to roughly estimate dawn and dusk.

func (*Station) Serve

func (station *Station) Serve(rw io.ReadWriteCloser) error

Reads a nex request from rw and tries to serve the matching file.

func (*Station) ServeAt

func (station *Station) ServeAt(tm time.Time, rw io.ReadWriteCloser) error

Tries to serve a request at the specific time tm. Useful for testing Nocturnal stations.

Jump to

Keyboard shortcuts

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