threebot

package module
v0.0.0-...-ab3f8cb Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

README

Installation

in plugin.cfg add threebot:github.com/threefoldtech/threebot_coredns

Configuration

in Corefile

. {
    threebot ZONE {
        explorer EXPLORER_URL
    }
}

e.g

. {
    threebot grid.tf. {
        explorer "https://explorer.testnet.threefoldtoken.com"
    }
}

that will enable threebot against testnet explorer

Running

cat ~/Corefile
. {
    threebot grid.tf. {
    	explorer https://explorer.testnet.threefoldtoken.com
    }
}
 ./coredns -conf ~/Corefile -dns.port 1053
.:1053
2019-05-08T12:27:37.303+02:00 [INFO] CoreDNS-1.5.0
2019-05-08T12:27:37.303+02:00 [INFO] linux/amd64, go1.12.4, 8be8dd18-dirty
CoreDNS-1.5.0
linux/amd64, go1.12.4, 8be8dd18-dirty

Example

we have a 3bot record

{"record":{"id":38,"addresses":["google.com","8.8.8.8","192.168.12.42","2001:db8:85a3::8a2e:370:7334"],"names":["codepaste.thabeta"],"publickey":"ed25519:47ae06c4457f8fc1ec9ecc944fc05459d320670575a95b517465b6c332a7f2d2","expiration":1559901840}}

Asking for A records

dig A codepaste.thabeta.grid.tf -p 1053

; <<>> DiG 9.11.3-1ubuntu1.7-Ubuntu <<>> A codepaste.thabeta.grid.tf -p 1053
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22860
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 5e8985f723928c22 (echoed)
;; QUESTION SECTION:
;codepaste.thabeta.grid.tf.	IN	A

;; ANSWER SECTION:
codepaste.thabeta.grid.tf. 300	IN	A	8.8.8.8
codepaste.thabeta.grid.tf. 300	IN	A	192.168.12.42

;; Query time: 74 msec
;; SERVER: 127.0.0.53#1053(127.0.0.53)
;; WHEN: Wed May 08 12:31:39 EET 2019
;; MSG SIZE  rcvd: 148


Asking for AAAA records

dig AAAA codepaste.thabeta.grid.tf -p 1053

; <<>> DiG 9.11.3-1ubuntu1.7-Ubuntu <<>> AAAA codepaste.thabeta.grid.tf -p 1053
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59266
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 86fe5e9946a6698c (echoed)
;; QUESTION SECTION:
;codepaste.thabeta.grid.tf.	IN	AAAA

;; ANSWER SECTION:
codepaste.thabeta.grid.tf. 360	IN	AAAA	2001:db8:85a3::8a2e:370:7334

;; Query time: 70 msec
;; SERVER: 127.0.0.53#1053(127.0.0.53)
;; WHEN: Wed May 08 12:31:34 EET 2019
;; MSG SIZE  rcvd: 119

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AAAA_Record

type AAAA_Record struct {
	Ttl uint32 `json:"ttl,omitempty"`
	Ip  net.IP `json:"ip"`
}

type A_Record

type A_Record struct {
	Ttl uint32 `json:"ttl,omitempty"`
	Ip  net.IP `json:"ip"`
}

type CAA_Record

type CAA_Record struct {
	Name  string `json:"name"`
	Flag  uint8  `json:"flag"` // 0
	Tag   string `json:"tag"`  //issue/issuewild//iodef
	Value string `json:"value"`
	Ttl   uint32 `json:"ttl,omitempty"`
}

type CNAME_Record

type CNAME_Record struct {
	Ttl  uint32 `json:"ttl,omitempty"`
	Host string `json:"host"`
}

type Record

type Record struct {
	A     []A_Record     `json:"a,omitempty"`
	AAAA  []AAAA_Record  `json:"aaaa,omitempty"`
	CNAME []CNAME_Record `json:"cname,omitempty"`
	CAA   []CAA_Record   `json:"caa,omitempty"`
}

type ThreeBotRecord

type ThreeBotRecord struct {
	Addresses []string `json:"addresses"`
	Names     []string `json:"names"`
}

type Threebot

type Threebot struct {
	Next      plugin.Handler
	Ttl       uint32
	Zones     []string
	Explorers []string
}

func (*Threebot) A

func (threebot *Threebot) A(name, z string, record *Record) (answers, extras []dns.RR)

func (Threebot) AAAA

func (threebot Threebot) AAAA(name, z string, record *Record) (answers, extras []dns.RR)

func (Threebot) CAA

func (threebot Threebot) CAA(name, z string, record *Record) (answers, extras []dns.RR)

func (*Threebot) CNAME

func (threebot *Threebot) CNAME(name, z string, record *Record) (answers, extras []dns.RR)

func (*Threebot) Name

func (threebot *Threebot) Name() string

Name implements the Handler interface.

func (*Threebot) ServeDNS

func (threebot *Threebot) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

type WhoIsResponse

type WhoIsResponse struct {
	ThreeBotRecord `json:"record"`
}

type Zone

type Zone struct {
	Name      string
	Locations map[string]Record
}

Jump to

Keyboard shortcuts

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