server

package
v0.0.0-...-f8362a8 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CassandraDB

type CassandraDB struct {
	Print bool
	// contains filtered or unexported fields
}

CassandraDB : Implements DBDriver and holds the cassandra session

func (*CassandraDB) ConnectDB

func (c *CassandraDB) ConnectDB(ips []string)

ConnectDB : Starts a cassandra session to a cluster given the ips. If it fails it dies

func (*CassandraDB) Disconnect

func (c *CassandraDB) Disconnect()

Disconnect : ends the cassandra session

func (*CassandraDB) Handle

func (c *CassandraDB) Handle(w dns.ResponseWriter, r *dns.Msg)

Handle : function to call on the dns server when a package is received. Prepares the package and calls Cassandra to fill it up

func (*CassandraDB) HandleFile

func (c *CassandraDB) HandleFile(location string, replace bool)

HandleFile reads a file containing RRs a uploads them replacing if set

func (*CassandraDB) MakeQuery

func (c *CassandraDB) MakeQuery(m *dns.Msg) int

MakeQuery : using a valid session stored on CassandraDB makes a get query to the desired database

func (*CassandraDB) UploadRR

func (c *CassandraDB) UploadRR(line string) error

UploadRR to Cassandra Cluster from line

type DBDriver

type DBDriver interface {
	MakeQuery(m *dns.Msg) int
	UploadRR(line string) error
	HandleFile(location string, replace bool)
	ConnectDB(ips []string)
	Disconnect()
	Handle(w dns.ResponseWriter, r *dns.Msg)
}

DBDriver : Database driver interface

func Start

func Start(db, rawIps string, soreuseport, port int, verbose bool) DBDriver

Start server

type EtcdDB

type EtcdDB struct {
	Timeout time.Duration
	Print   bool
	// contains filtered or unexported fields
}

EtcdDB : Implements DBDriver and holds the etcd client

func (*EtcdDB) ConnectDB

func (edb *EtcdDB) ConnectDB(ips []string)

ConnectDB : assign etcd cluster client given the IPs and ports

func (*EtcdDB) Disconnect

func (edb *EtcdDB) Disconnect()

Disconnect : Closes the Ectd client

func (*EtcdDB) Handle

func (edb *EtcdDB) Handle(w dns.ResponseWriter, r *dns.Msg)

Handle : function to call on the dns server when a package is received. Prepares the package and calls Etcd to fill it up

func (*EtcdDB) HandleFile

func (edb *EtcdDB) HandleFile(location string, replace bool)

HandleFile reads a file containing RRs a uploads them replacing if set

func (*EtcdDB) MakeQuery

func (edb *EtcdDB) MakeQuery(m *dns.Msg) int

MakeQuery : using a valid Etcd Client makes a get query

Records will be in format DomainName:Type "TTL VALUES,TTL VALUES..."

func (*EtcdDB) UploadRR

func (edb *EtcdDB) UploadRR(line string) error

UploadRR to Etcd Cluster from line appending it to the end of the value

type RedisKVS

type RedisKVS struct {
	Print bool
	// contains filtered or unexported fields
}

RedisKVS : Implements DBDriver and holds the redis cluster client

func (*RedisKVS) ConnectDB

func (r *RedisKVS) ConnectDB(ips []string)

ConnectDB : assign redis cluster client given the IPs and ports

func (*RedisKVS) Disconnect

func (r *RedisKVS) Disconnect()

Disconnect : Closes the Redis client

func (*RedisKVS) Handle

func (r *RedisKVS) Handle(w dns.ResponseWriter, req *dns.Msg)

Handle : function to call on the dns server when a package is received. Prepares the package and calls Redis to fill it up

func (*RedisKVS) HandleFile

func (r *RedisKVS) HandleFile(location string, replace bool)

HandleFile reads a file containing RRs a uploads them replacing if set

func (*RedisKVS) MakeQuery

func (r *RedisKVS) MakeQuery(m *dns.Msg) int

MakeQuery : using a valid Redis client makes a get query

func (*RedisKVS) UploadRR

func (r *RedisKVS) UploadRR(line string) error

UploadRR to Cassandra Cluster from line

Jump to

Keyboard shortcuts

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