mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 20:12:26 -05:00 
			
		
		
		
	- update gruf/go-stroage v0.2.0 -> v0.2.1 - update KimMachineGun/automemlimit v0.7.1 -> v0.7.2 - update miekg/dns v1.1.65 -> v1.1.66 - update ncruces/go-sqlite3 v0.25.1 -> v0.25.2 - update spf13/cast v1.7.1 -> v1.8.0 - update tdewolff/minify/v2 v2.23.1 -> v2.23.5 - update x/crypto v0.37.0 -> v0.38.0 - update x/image v0.26.0 -> v0.27.0 - update x/net v0.39.0 -> v0.40.0 - update x/oauth2 v0.29.0 -> v0.30.0 - update x/sys v0.32.0 -> v0.33.0 - update x/text v0.24.0 -> v0.25.0 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4162 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
		
			
				
	
	
		
			55 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			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)
 | |
| 
 | |
| func init() {
 | |
| 	// Preserve previous NOTIMP typo, see github.com/miekg/dns/issues/733.
 | |
| 	StringToRcode["NOTIMPL"] = RcodeNotImplemented
 | |
| }
 | |
| 
 | |
| // StringToAlgorithm is the reverse of AlgorithmToString.
 | |
| var StringToAlgorithm = reverseInt8(AlgorithmToString)
 | |
| 
 | |
| // StringToHash is a map of names to hash IDs.
 | |
| var StringToHash = reverseInt8(HashToString)
 | |
| 
 | |
| // StringToCertType is the reverse of CertTypeToString.
 | |
| var StringToCertType = reverseInt16(CertTypeToString)
 | |
| 
 | |
| // StringToStatefulType is the reverse of StatefulTypeToString.
 | |
| var StringToStatefulType = reverseInt16(StatefulTypeToString)
 | |
| 
 | |
| // 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
 | |
| }
 |