mirror of
https://github.com/eolinker/apinto
synced 2025-10-20 23:40:13 +08:00
uuid优化
This commit is contained in:
2
go.mod
2
go.mod
@@ -12,6 +12,8 @@ require (
|
|||||||
github.com/nacos-group/nacos-sdk-go v1.0.8 // indirect
|
github.com/nacos-group/nacos-sdk-go v1.0.8 // indirect
|
||||||
github.com/pkg/sftp v1.13.2
|
github.com/pkg/sftp v1.13.2
|
||||||
github.com/robertkrimen/otto v0.0.0-20210614181706-373ff5438452
|
github.com/robertkrimen/otto v0.0.0-20210614181706-373ff5438452
|
||||||
|
github.com/satori/go.uuid v1.2.0
|
||||||
|
github.com/sbunce/bson v0.0.0-20181119052045-2aa5ebe749b2 // indirect
|
||||||
github.com/valyala/fasthttp v1.28.0
|
github.com/valyala/fasthttp v1.28.0
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
|
||||||
gopkg.in/sourcemap.v1 v1.0.5 // indirect
|
gopkg.in/sourcemap.v1 v1.0.5 // indirect
|
||||||
|
4
go.sum
4
go.sum
@@ -124,6 +124,10 @@ github.com/robertkrimen/otto v0.0.0-20210614181706-373ff5438452 h1:ewTtJ72GFy2e0
|
|||||||
github.com/robertkrimen/otto v0.0.0-20210614181706-373ff5438452/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY=
|
github.com/robertkrimen/otto v0.0.0-20210614181706-373ff5438452/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY=
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
|
github.com/sbunce/bson v0.0.0-20181119052045-2aa5ebe749b2 h1:uEWAxH5RIhQ9kXzoLvRXaaz0pfq9hWPMEhF/9BcoZDU=
|
||||||
|
github.com/sbunce/bson v0.0.0-20181119052045-2aa5ebe749b2/go.mod h1:19bU15EB+sPE8EJyr+o7AY5WooIZvRKg4BTYOToZMtM=
|
||||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
|
@@ -4,7 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-basic/uuid"
|
uuid2 "github.com/satori/go.uuid"
|
||||||
|
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
|
|
||||||
@@ -132,7 +132,8 @@ func (ctx *Context) RequestId() string {
|
|||||||
|
|
||||||
//NewContext 创建Context
|
//NewContext 创建Context
|
||||||
func NewContext(requestCtx *fasthttp.RequestCtx) *Context {
|
func NewContext(requestCtx *fasthttp.RequestCtx) *Context {
|
||||||
requestID := uuid.New()
|
//requestID := uuid.New()
|
||||||
|
id := uuid2.NewV4()
|
||||||
requestReader := NewRequestReader(requestCtx.Request)
|
requestReader := NewRequestReader(requestCtx.Request)
|
||||||
ctx := &Context{
|
ctx := &Context{
|
||||||
responseWriter: requestCtx,
|
responseWriter: requestCtx,
|
||||||
@@ -143,7 +144,7 @@ func NewContext(requestCtx *fasthttp.RequestCtx) *Context {
|
|||||||
RequestOrg: requestReader,
|
RequestOrg: requestReader,
|
||||||
ProxyRequest: NewRequest(requestReader),
|
ProxyRequest: NewRequest(requestReader),
|
||||||
ProxyResponseHandler: nil,
|
ProxyResponseHandler: nil,
|
||||||
requestID: requestID,
|
requestID: id.String(),
|
||||||
LogFields: access_field.NewFields(),
|
LogFields: access_field.NewFields(),
|
||||||
}
|
}
|
||||||
//ctx.LogFields.RequestHeader = utils.HeaderToString(requestReader.Headers())
|
//ctx.LogFields.RequestHeader = utils.HeaderToString(requestReader.Headers())
|
||||||
|
Reference in New Issue
Block a user