Documentation ¶
Index ¶
- Constants
- func DateEqual(date1, date2 time.Time) bool
- type CustomValidator
- type Envs
- type Error
- type Handler
- func (h *Handler) AddCName(c echo.Context) (err error)
- func (h *Handler) AddHost(c echo.Context) (err error)
- func (h *Handler) AuthenticateAdmin(username, password string, c echo.Context) (bool, error)
- func (h *Handler) AuthenticateUpdate(username, password string, c echo.Context) (bool, error)
- func (h *Handler) CheckClearInterval()
- func (h *Handler) ClearLogs()
- func (h *Handler) CreateCName(c echo.Context) (err error)
- func (h *Handler) CreateHost(c echo.Context) (err error)
- func (h *Handler) CreateLogEntry(log *model.Log) (err error)
- func (h *Handler) DeleteCName(c echo.Context) (err error)
- func (h *Handler) DeleteHost(c echo.Context) (err error)
- func (h *Handler) EditHost(c echo.Context) (err error)
- func (h *Handler) GetHost(c echo.Context) (err error)
- func (h *Handler) InitDB() (err error)
- func (h *Handler) ListCNames(c echo.Context) (err error)
- func (h *Handler) ListHosts(c echo.Context) (err error)
- func (h *Handler) ParseEnvs() (adminAuth bool, err error)
- func (h *Handler) ShowHostLogs(c echo.Context) (err error)
- func (h *Handler) ShowLogs(c echo.Context) (err error)
- func (h *Handler) UpdateHost(c echo.Context) (err error)
- func (h *Handler) UpdateIP(c echo.Context) (err error)
Constants ¶
const (
UNAUTHORIZED = "You are not allowed to view that content"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CustomValidator ¶
type CustomValidator struct {
Validator *validator.Validate
}
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i interface{}) error
Validate implements the Validator.
type Handler ¶
type Handler struct { DB *gorm.DB AuthAdmin bool Config Envs Title string DisableAdminAuth bool LastClearedLogs time.Time ClearInterval uint64 AllowWildcard bool LogoutUrl string }
func (*Handler) AddCName ¶
AddCName just renders the "add cname" website. Therefore all host entries from the database are being fetched.
func (*Handler) AuthenticateAdmin ¶
func (*Handler) AuthenticateUpdate ¶
Authenticate is the method the website admin user and the host update user have to authenticate against. To gather admin rights the username password combination must match with the credentials given by the env var.
func (*Handler) CheckClearInterval ¶
func (h *Handler) CheckClearInterval()
Check if a log cleaning is needed
func (*Handler) CreateCName ¶
CreateCName validates the cname data from the "add cname" website, adds the cname entry to the database, and adds the entry to the DNS server.
func (*Handler) CreateHost ¶
CreateHost validates the host data from the "add host" website, adds the host entry to the database, and adds the entry to the DNS server.
func (*Handler) CreateLogEntry ¶
CreateLogEntry simply adds a log entry to the database.
func (*Handler) DeleteCName ¶
DeleteCName fetches a cname entry from the database by "id" and deletes the database and DNS server entry to it.
func (*Handler) DeleteHost ¶
DeleteHost fetches a host entry from the database by "id" and deletes the database and DNS server entry to it.
func (*Handler) InitDB ¶
InitDB creates an empty database and creates all tables if there isn't already one, or opens the existing one.
func (*Handler) ListCNames ¶
ListCNames fetches all cnames from database and lists them on the website.
func (*Handler) ListHosts ¶
ListHosts fetches all hosts from database and lists them on the website.
func (*Handler) ParseEnvs ¶
ParseEnvs parses all needed environment variables: DDNS_ADMIN_LOGIN: The basic auth login string in htpasswd style. DDNS_DOMAINS: All domains that will be handled by the dyndns server.
func (*Handler) ShowHostLogs ¶
ShowHostLogs fetches all log entries of a specific host by "id" and renders them to the website.
func (*Handler) ShowLogs ¶
ShowLogs fetches all log entries from all hosts and renders them to the website.
func (*Handler) UpdateHost ¶
UpdateHost validates the host data from the "edit host" website, and compares the host data with the entry in the database by "id". If anything has changed the database and DNS entries for the host will be updated.