wasm

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

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

coredns-wasm

By using the coredns-wasm module, you can execute WebAssembly modules as a data source for CoreDNS.

Functionalities

  • Embedded runtime
  • Return records: A, AAAA, CNAME, TXT
  • Return errors
  • Read and write metadata

Syntax

wasm {
    wasmPath [PATH]
}
  • wasmPath is the path to your WebAssembly module

Example

. {
    wasm {
        wasmPath "./a_record.wasm"
    }
}

Checkout the example in the ./wasm dir to understand how to write the actual WASM module.

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 CNAME_Record

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

type Query

type Query struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

type Record

type Record struct {
	A     []A_Record     `json:"a,omitempty"`
	AAAA  []AAAA_Record  `json:"aaaa,omitempty"`
	TXT   []TXT_Record   `json:"txt,omitempty"`
	CNAME []CNAME_Record `json:"cname,omitempty"`
}

copied from https://github.com/codysnider/coredns-redis/blob/master/types.go

type TXT_Record

type TXT_Record struct {
	Ttl  uint32 `json:"ttl,omitempty"`
	Text string `json:"text"`
}

type Wasm

type Wasm struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

func (*Wasm) A

func (wasm *Wasm) A(name string, record *Record) (answers []dns.RR)

copied from https://github.com/codysnider/coredns-redis/blob/master/redis.go

func (*Wasm) AAAA

func (wasm *Wasm) AAAA(name string, record *Record) (answers []dns.RR)

func (*Wasm) CNAME

func (wasm *Wasm) CNAME(name string, record *Record) (answers []dns.RR)

func (*Wasm) Name

func (wasm *Wasm) Name() string

func (*Wasm) ServeDNS

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

func (*Wasm) TXT

func (wasm *Wasm) TXT(name string, record *Record) (answers []dns.RR)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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