dns

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteRules

func DeleteRules(c *gin.Context)

DeleteRules Delete dns rule from user submit

func ListRules

func ListRules(c *gin.Context)

ListRules lists all dns rules those satisfy the filter

func Records added in v0.2.1

func Records(c *gin.Context)

func UpsertRules

func UpsertRules(c *gin.Context)

UpsertRules creates or updates dns rule from user submit

Types

type Config

type Config struct {
	Enable bool
	Addr   string
}

type Record

type Record struct {
	Domain string `gorm:"index" form:"domain" json:"domain"`
	Value  string `form:"value" json:"value"`

	record.BaseRecord
	Rule Rule `gorm:"foreignKey:RuleName;references:Name;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" form:"-" json:"-" notice:"-"`
}

func (Record) Notice

func (r Record) Notice()

func (Record) TableName

func (Record) TableName() string

type Rule

type Rule struct {
	rule.BaseRule `yaml:",inline"`
	Type          newdns.Type   `gorm:"default:1" form:"type" json:"type"`
	Value         string        `form:"value" json:"value"`
	TTL           time.Duration `gorm:"ttl;default:10" form:"ttl" json:"ttl"`
}

func NewRule

func NewRule(name, flagFormat, value string, pushToClient, notice bool, _type newdns.Type, ttl time.Duration) *Rule

NewRule new dns rule struct

func (*Rule) CreateOrUpdate

func (r *Rule) CreateOrUpdate() (err error)

CreateOrUpdate creates or updates the dns rule in database and ruleSet

func (*Rule) Delete

func (r *Rule) Delete() (err error)

Delete deletes the dns rule in database and ruleSet

func (Rule) TableName

func (Rule) TableName() string

type Server

type Server struct {
	Config
	// contains filtered or unexported fields
}

func GetServer

func GetServer() *Server

func (*Server) Restart

func (s *Server) Restart()

func (*Server) Run

func (s *Server) Run()

func (*Server) SetServerDomain

func (s *Server) SetServerDomain(serverDomains []string) *Server

func (*Server) SetServerIP

func (s *Server) SetServerIP(serverIP string) *Server

func (*Server) Stop

func (s *Server) Stop()

func (*Server) UpdateRules

func (s *Server) UpdateRules() error

Jump to

Keyboard shortcuts

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