mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 20:16:52 +00:00
add functions
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"github.com/cnlh/nps/lib/crypt"
|
||||
"github.com/cnlh/nps/lib/pool"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -246,3 +248,10 @@ func GetIpByAddr(addr string) string {
|
||||
arr := strings.Split(addr, ":")
|
||||
return arr[0]
|
||||
}
|
||||
|
||||
func CopyBuffer(dst io.Writer, src io.Reader) (written int64, err error) {
|
||||
buf := pool.BufPoolCopy.Get().([]byte)
|
||||
io.CopyBuffer(dst, src, buf)
|
||||
pool.PutBufPoolCopy(buf)
|
||||
return written, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user