httprism

package module
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPRISM_DIR    = "HTTPRISM_DIR"
	HTTPRISM_CONFIG = "HTTPRISM_CONFIG"
)
View Source
const CurrLog = "curr.log"

Variables

View Source
var (
	ErrNotExist = errors.New("app does not exist")
)

Functions

func DefaultConfig

func DefaultConfig() string

func DefaultConfigDir

func DefaultConfigDir() string

func EmptyPort

func EmptyPort(host string) (port string, err error)

func FindConfig

func FindConfig(s string) string

func SortHosts

func SortHosts(hosts []string)

Types

type Addr

type Addr struct {
	Host string `toml:",omitempty"`
	Port uint   `toml:",omitempty"`
}

func (*Addr) Setup

func (addr *Addr) Setup()

func (*Addr) String

func (addr *Addr) String() string

type App

type App struct {
	Name    string
	Host    string
	Path    string
	Address string
	Cmd     *exec.Cmd
}

func (*App) Kill

func (app *App) Kill() error

func (*App) Quit

func (app *App) Quit() error

graceful stop

func (*App) Restart

func (app *App) Restart() error

graceful restart

func (*App) Signal

func (app *App) Signal(sig os.Signal) error

type Config

type Config struct {
	Sites   string
	Log     string
	Rc      string
	Listen  string
	Logging string
	MaxLogs int
	Domain  []string `toml:"domains,omitempty"`
	Dotrc   []string `toml:",omitempty"`
	Env     []string `toml:",omitempty"`
	Editor  []string `toml:",omitempty"`

	TLS struct {
		Crt []string
		Key []string
	}

	DNS  Addr
	HTTP Addr
	API  Addr

	Launch map[string]*Launch
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() *Config

func (*Config) Address

func (conf *Config) Address() string

func (*Config) AppByHost

func (conf *Config) AppByHost(host string) (*App, error)

func (*Config) AppByName

func (conf *Config) AppByName(name string) (app *App, err error)

func (*Config) AppByPath

func (conf *Config) AppByPath(path string) (app *App, err error)

func (*Config) Apps

func (conf *Config) Apps() map[string]*App

func (*Config) Domains

func (conf *Config) Domains() []string

func (*Config) Edit

func (conf *Config) Edit() error

func (*Config) FindApp

func (conf *Config) FindApp(name string) (*App, error)

func (*Config) GetCertificate

func (conf *Config) GetCertificate(app *App) (*tls.Certificate, error)

func (*Config) HasCertificate

func (conf *Config) HasCertificate(app *App) bool

func (*Config) Hosts

func (conf *Config) Hosts() []string

func (*Config) LaunchByApp

func (conf *Config) LaunchByApp(app *App) *Launch

func (*Config) LaunchByPath

func (conf *Config) LaunchByPath(dir string) *Launch

func (*Config) LoadConfig

func (conf *Config) LoadConfig(fname string) error

func (*Config) LogByApp

func (conf *Config) LogByApp(app *App, t *time.Time) string

func (*Config) Logger

func (conf *Config) Logger() logr.Logger

func (*Config) LogsByApp

func (conf *Config) LogsByApp(app *App) ([]string, error)

func (*Config) MakeURL

func (conf *Config) MakeURL(app *App) string

func (*Config) Mkdirs

func (conf *Config) Mkdirs() error

func (*Config) NewShell

func (conf *Config) NewShell(rc ...string) *dotrc.Dotrc

func (*Config) ServerLog

func (conf *Config) ServerLog() string

type DNSSD

type DNSSD struct {
	Config *Config

	Responder dnssd.Responder
	Hosts     map[string]dnssd.ServiceHandle
	Watcher   *fsnotify.Watcher
	// contains filtered or unexported fields
}

func NewDNSSD

func NewDNSSD(config *Config, dnssdConfig dnssd.Config) *DNSSD

func (*DNSSD) Add

func (sd *DNSSD) Add(host string) error

func (*DNSSD) Remove

func (sd *DNSSD) Remove(host string)

func (*DNSSD) Root

func (sd *DNSSD) Root() string

func (*DNSSD) Run

func (sd *DNSSD) Run() error

type DuplicationError

type DuplicationError struct {
	Data []string
}

func (*DuplicationError) Error

func (e *DuplicationError) Error() string

type Hosts

type Hosts []string

func (Hosts) Len

func (h Hosts) Len() int

func (Hosts) Less

func (h Hosts) Less(i, j int) bool

func (Hosts) Swap

func (h Hosts) Swap(i, j int)

type Launch

type Launch struct {
	Config  string
	Dotrc   []string `toml:",omitempty"`
	Command []string
	Logs    []string `toml:",omitempty"`
	Host    []string `toml:",omitempty"`
}

func (*Launch) Expand

func (l *Launch) Expand(port string) (string, []string)

type NameServer

type NameServer struct {
	Config *Config
}

func (*NameServer) HandleRequest

func (s *NameServer) HandleRequest(w dns.ResponseWriter, req *dns.Msg)

func (*NameServer) Run

func (s *NameServer) Run(addr string) error

type PathError

type PathError struct {
	Op   string
	Path string
	Err  error
}

func (*PathError) Error

func (e *PathError) Error() string

type Server

type Server struct {
	Config *Config
	Apps   map[string]*App
	Port   string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conf *Config) *Server

func (*Server) Director

func (s *Server) Director(req *http.Request)

func (*Server) Launch

func (s *Server) Launch(app *App) (addr string, err error)

func (*Server) OpenLog

func (s *Server) OpenLog(app *App) (*os.File, error)

func (*Server) Run

func (s *Server) Run(addr string) error

Directories

Path Synopsis
cmd
httprism command
inst

Jump to

Keyboard shortcuts

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