msggateway refactor

This commit is contained in:
Gordon
2023-02-14 21:08:36 +08:00
parent e83a070e81
commit 71f1fcee57
10 changed files with 572 additions and 3 deletions
+27
View File
@@ -0,0 +1,27 @@
package new
import "net/http"
type UserConnContext struct {
RespWriter http.ResponseWriter
Req *http.Request
Path string
Method string
RemoteAddr string
}
func newContext(respWriter http.ResponseWriter, req *http.Request) *UserConnContext {
return &UserConnContext{
RespWriter: respWriter,
Req: req,
Path: req.URL.Path,
Method: req.Method,
RemoteAddr: req.RemoteAddr,
}
}
func (c *UserConnContext) Query(key string) string {
return c.Req.URL.Query().Get(key)
}
func (c *UserConnContext) GetHeader(key string) string {
return c.Req.Header.Get(key)
}