mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 18:53:13 -05:00 
			
		
		
		
	* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat
		
			
				
	
	
		
			27 lines
		
	
	
		
			456 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			456 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package msg
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
 | 
						|
	lib "github.com/dnstap/golang-dnstap"
 | 
						|
	"github.com/golang/protobuf/proto"
 | 
						|
)
 | 
						|
 | 
						|
func wrap(m *lib.Message) *lib.Dnstap {
 | 
						|
	t := lib.Dnstap_MESSAGE
 | 
						|
	return &lib.Dnstap{
 | 
						|
		Type:    &t,
 | 
						|
		Message: m,
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
// Marshal encodes the message to a binary dnstap payload.
 | 
						|
func Marshal(m *lib.Message) (data []byte, err error) {
 | 
						|
	data, err = proto.Marshal(wrap(m))
 | 
						|
	if err != nil {
 | 
						|
		err = fmt.Errorf("proto: %s", err)
 | 
						|
		return
 | 
						|
	}
 | 
						|
	return
 | 
						|
}
 |