mirror of
https://github.com/andwati/dns-resolver.git
synced 2026-11-13 14:25:14 +00:00
implemented utility functions
This commit is contained in:
@@ -1 +1,15 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
|
import "encoding/binary"
|
||||||
|
|
||||||
|
func uint16ToBytes(val uint16) []byte {
|
||||||
|
buf := make([]byte, 2)
|
||||||
|
binary.BigEndian.PutUint16(buf, val)
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
func uint32ToBytes(val uint32) []byte {
|
||||||
|
buf := make([]byte, 4)
|
||||||
|
binary.BigEndian.PutUint32(buf, val)
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user