summary refs log tree commit diff stats
path: root/types.go
blob: 1aaf7a8f2961ff00e45fde25b055840df74c3786 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main

import (
	"sync"
	"time"
)

// content-type consts
const txtutf8 = "text/plain; charset=utf-8"
const htmlutf8 = "text/html; charset=utf-8"
const cssutf8 = "text/css; charset=utf-8"

// config object definition
type configuration struct {
	mu            sync.RWMutex
	port          int
	logFile       string
	dbPath        string
	stdoutLogging bool
	version       string
	cacheInterval time.Duration
	dbInterval    time.Duration
	lastCache     time.Time
	lastPush      time.Time
	Instance
}

// Instance refers to this specific instance of getwtxt
type Instance struct {
	Name  string
	URL   string
	Owner string
	Mail  string
	Desc  string
}

// RemoteRegistries holds a list of remote registries to
// periodically scrape for new users. The remote registries
// must have been added via POST like a user.
type RemoteRegistries struct {
	Mu   sync.RWMutex
	List []string
}

// ipCtxKey is the Context value key for user IP addresses
type ipCtxKey int

const ctxKey ipCtxKey = iota