优化性能

This commit is contained in:
hebo
2019-08-13 15:51:33 +08:00
parent c42113b8f8
commit f8a85e0af6
15 changed files with 234 additions and 112 deletions

View File

@@ -34,7 +34,19 @@ func getLocalIPAddr() (ipAddr string, err error) {
return
}
func spliceSessionKey(srcIP string, srcPort int) (sessionKey string) {
sessionKey = fmt.Sprintf("%s:%d", srcIP, srcPort)
return
func spliceSessionKey(srcIP *string, srcPort int) (*string) {
// var buf strings.Builder
// _, err := fmt.Fprint(&buf, *srcIP, ":", srcPort)
// if err != nil {
// panic(err.Error())
// }
// sessionKey := buf.String()
// buf := new(bytes.Buffer)
// _ = templateSessionKey.ExecuteTemplate(buf, "IP", srcIP)
// _ = templateSessionKey.ExecuteTemplate(buf, "Port", srcPort)
// sessionKey := buf.String()
sessionKey := fmt.Sprintf("%s:%d", *srcIP, srcPort)
return &sessionKey
}