server

package
v0.0.0-...-16a83fc Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MESSAGE_WRONG_METHOD           = "Wrong Method, expected GET or POST"
	MESSAGE_WRONG_CONTENT_TYPE     = "Wrong Content-Type, expected application/json"
	MESSAGE_REQUEST_PARSING_FAILED = "Failed to parse the request, received wrong or malformed parameters"
	MESSAGE_UNAUTHORIZED           = "Failed to authenticate to cloudflare"
	MESSAGE_DOMAINS_FORBIDDEN      = "At least one of the provided domains is not allowed to be handled by this server"
	MESSAGE_INVALID_IP             = "Either no IP or an invalid IP has been provided"
	MESSAGE_MISSING_DOMAIN         = "No domains have been provided"
	MESSAGE_FAILED_UPDATE          = "Failed to update the records"
	MESSAGE_SUCCESS                = "Updated dyndns records"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestParams

type RequestParams struct {
	// To maintain compatibility with https://github.com/1rfsNet/Fritz-Box-Cloudflare-DynDNS, the cf_key and domain can be used as well for token and domains when doing GET
	Token   string   `json:"token"`           // Token needed for accessing cloudflare api.
	Domains []string `json:"domains"`         // The domain to update, parsed from comma (,) separated string, needs at least 1.
	IPv4    string   `json:"ipv4,omitempty"`  // IPv4 Address, optional, when IPv6 set
	IPv6    string   `json:"ipv6,omitempty"`  // IPv6 Address, optional, when IPv4 set
	Proxy   bool     `json:"proxy,omitempty"` // Indicate if domain should be proxied, defaults to true
}

type Response

type Response struct {
	Message string `json:"msg"`
	Success bool   `json:"success"`
}

type Server

type Server struct {
	Addr    string
	Domains map[string]bool
	SSL     config.SSLConfig
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c config.ServerConfig) *Server

Return a new Server, created from the provided config

func (*Server) Run

func (s *Server) Run() error

Starts the server and exits with error if that fails

Jump to

Keyboard shortcuts

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