github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/byte/utils.go (about) 1 // Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . 2 3 package byteutils 4 5 // Copy bytes 6 func Copy(b []byte) []byte { 7 var l = len(b) 8 if l == 0 { 9 return []byte{} 10 } 11 var d = make([]byte, l) 12 copy(d, b) 13 return d 14 } 15 16 // Append bytes 17 func Append(b []byte, b2 ...byte) []byte { 18 return append(Copy(b), b2...) 19 } 20 21 // Concat bytes 22 func Concat(b []byte, b2 ...[]byte) []byte { 23 b = Copy(b) 24 for _, b3 := range b2 { 25 b = append(b, b3...) 26 } 27 return b 28 }