mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	The vendor/ folder was created with the help of @FiloSottile's gvt and vendorcheck. Any dependencies of Caddy plugins outside this repo are not vendored. We do not remove any unused, vendored packages because vendorcheck -u only checks using the current build configuration; i.e. packages that may be imported by files toggled by build tags of other systems. CI tests have been updated to ignore the vendor/ folder. When Go 1.9 is released, a few of the go commands should be revised to again use ./... as it will ignore the vendor folder by default.
		
			
				
	
	
		
			39 lines
		
	
	
		
			897 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			897 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package dns
 | 
						|
 | 
						|
// StringToType is the reverse of TypeToString, needed for string parsing.
 | 
						|
var StringToType = reverseInt16(TypeToString)
 | 
						|
 | 
						|
// StringToClass is the reverse of ClassToString, needed for string parsing.
 | 
						|
var StringToClass = reverseInt16(ClassToString)
 | 
						|
 | 
						|
// StringToOpcode is a map of opcodes to strings.
 | 
						|
var StringToOpcode = reverseInt(OpcodeToString)
 | 
						|
 | 
						|
// StringToRcode is a map of rcodes to strings.
 | 
						|
var StringToRcode = reverseInt(RcodeToString)
 | 
						|
 | 
						|
// Reverse a map
 | 
						|
func reverseInt8(m map[uint8]string) map[string]uint8 {
 | 
						|
	n := make(map[string]uint8, len(m))
 | 
						|
	for u, s := range m {
 | 
						|
		n[s] = u
 | 
						|
	}
 | 
						|
	return n
 | 
						|
}
 | 
						|
 | 
						|
func reverseInt16(m map[uint16]string) map[string]uint16 {
 | 
						|
	n := make(map[string]uint16, len(m))
 | 
						|
	for u, s := range m {
 | 
						|
		n[s] = u
 | 
						|
	}
 | 
						|
	return n
 | 
						|
}
 | 
						|
 | 
						|
func reverseInt(m map[int]string) map[string]int {
 | 
						|
	n := make(map[string]int, len(m))
 | 
						|
	for u, s := range m {
 | 
						|
		n[s] = u
 | 
						|
	}
 | 
						|
	return n
 | 
						|
}
 |