*: raven is archived, long live sentry-go
I don't have sentry set up to test this, but it looks like it is migrated correctly. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
f9ceebad58
commit
cabf16cc0a
97 changed files with 4518 additions and 12599 deletions
5
go.mod
5
go.mod
|
@ -3,14 +3,11 @@ module github.com/stellarproject/guard
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67 // indirect
|
|
||||||
github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067
|
github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067
|
||||||
github.com/getsentry/raven-go v0.2.0
|
github.com/getsentry/sentry-go v0.6.1
|
||||||
github.com/gogo/googleapis v1.3.0
|
github.com/gogo/googleapis v1.3.0
|
||||||
github.com/gogo/protobuf v1.3.0
|
github.com/gogo/protobuf v1.3.0
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
||||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
|
||||||
github.com/pkg/errors v0.8.1
|
github.com/pkg/errors v0.8.1
|
||||||
github.com/prometheus/client_golang v1.1.0 // indirect
|
github.com/prometheus/client_golang v1.1.0 // indirect
|
||||||
github.com/sirupsen/logrus v1.4.2
|
github.com/sirupsen/logrus v1.4.2
|
||||||
|
|
160
go.sum
160
go.sum
|
@ -1,60 +1,149 @@
|
||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw=
|
||||||
|
github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w=
|
||||||
|
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
|
||||||
|
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM=
|
||||||
|
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
|
||||||
|
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||||
|
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67 h1:8k9FLYBLKT+9v2HQJ/a95ZemmTx+/ltJcAiRhVushG8=
|
|
||||||
github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4=
|
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
|
||||||
|
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||||
|
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||||
|
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
|
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
|
||||||
|
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067 h1:jlV8Svz9lOwvxWBt2RN3uA1JUZ8AFj46boym2+Fx488=
|
github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067 h1:jlV8Svz9lOwvxWBt2RN3uA1JUZ8AFj46boym2+Fx488=
|
||||||
github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067/go.mod h1:+l2fIHwwiNb/sUw9RcsUH6wXnO07793PC4XjDWCuiHs=
|
github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067/go.mod h1:+l2fIHwwiNb/sUw9RcsUH6wXnO07793PC4XjDWCuiHs=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=
|
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
||||||
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
||||||
|
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||||
|
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
|
||||||
|
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
|
||||||
|
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
|
||||||
|
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||||
|
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
|
||||||
|
github.com/getsentry/sentry-go v0.6.1 h1:K84dY1/57OtWhdyr5lbU78Q/+qgzkEyGc/ud+Sipi5k=
|
||||||
|
github.com/getsentry/sentry-go v0.6.1/go.mod h1:0yZBuzSvbZwBnvaF9VwZIMen3kXscY8/uasKtAX1qG8=
|
||||||
|
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
|
||||||
|
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
|
||||||
|
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
|
||||||
|
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
|
||||||
|
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
|
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
|
||||||
|
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||||
|
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
|
||||||
github.com/gogo/googleapis v1.3.0 h1:M695OaDJ5ipWvDPcoAg/YL9c3uORAegkEfBqTQF/fTQ=
|
github.com/gogo/googleapis v1.3.0 h1:M695OaDJ5ipWvDPcoAg/YL9c3uORAegkEfBqTQF/fTQ=
|
||||||
github.com/gogo/googleapis v1.3.0/go.mod h1:d+q1s/xVJxZGKWwC/6UfPIF33J+G1Tq4GYv9Y+Tg/EU=
|
github.com/gogo/googleapis v1.3.0/go.mod h1:d+q1s/xVJxZGKWwC/6UfPIF33J+G1Tq4GYv9Y+Tg/EU=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE=
|
github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE=
|
||||||
github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||||
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||||
|
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
|
||||||
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
|
github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI=
|
||||||
|
github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0=
|
||||||
|
github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI=
|
||||||
|
github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
|
github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
|
||||||
|
github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
|
||||||
|
github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
|
||||||
|
github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk=
|
||||||
|
github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U=
|
||||||
|
github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw=
|
||||||
|
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0=
|
||||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
|
github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
|
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
|
||||||
|
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
|
||||||
|
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
|
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
|
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||||
|
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg=
|
||||||
|
github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ=
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM=
|
||||||
|
github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4=
|
||||||
|
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||||
|
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||||
|
@ -70,50 +159,113 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||||
github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
|
github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
|
||||||
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
|
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
|
||||||
|
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
|
||||||
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
|
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||||
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
||||||
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
|
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||||
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
|
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
|
||||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
|
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
|
github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
|
||||||
|
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||||
|
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
|
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
|
||||||
|
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
|
||||||
|
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
|
||||||
|
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=
|
||||||
|
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
|
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
|
||||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||||
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s=
|
google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s=
|
||||||
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
|
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||||
|
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
|
||||||
|
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
|
23
main.go
23
main.go
|
@ -35,9 +35,10 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "github.com/crosbymichael/guard/api/v1"
|
v1 "github.com/crosbymichael/guard/api/v1"
|
||||||
"github.com/getsentry/raven-go"
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/gogo/protobuf/types"
|
"github.com/gogo/protobuf/types"
|
||||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -72,8 +73,13 @@ func main() {
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
}
|
}
|
||||||
if dsn := clix.GlobalString("sentry-dsn"); dsn != "" {
|
if dsn := clix.GlobalString("sentry-dsn"); dsn != "" {
|
||||||
raven.SetDSN(dsn)
|
err := sentry.Init(sentry.ClientOptions{
|
||||||
raven.DefaultClient.SetRelease(app.Version)
|
Dsn: dsn,
|
||||||
|
Release: app.Version,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -86,7 +92,12 @@ func main() {
|
||||||
}
|
}
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
raven.CaptureErrorAndWait(err, nil)
|
sentry.CaptureMessage(err.Error())
|
||||||
|
if sentry.Flush(time.Second * 2) {
|
||||||
|
// event delivered?
|
||||||
|
} else {
|
||||||
|
fmt.Println(os.Stderr, "Failed to flush error to sentry")
|
||||||
|
}
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,7 +363,7 @@ func newGRPC() *grpc.Server {
|
||||||
func unary(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
|
func unary(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
|
||||||
r, err := grpc_prometheus.UnaryServerInterceptor(ctx, req, info, handler)
|
r, err := grpc_prometheus.UnaryServerInterceptor(ctx, req, info, handler)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
raven.CaptureError(err, nil)
|
sentry.CaptureException(err)
|
||||||
}
|
}
|
||||||
return r, err
|
return r, err
|
||||||
}
|
}
|
||||||
|
@ -360,7 +371,7 @@ func unary(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, han
|
||||||
func stream(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
func stream(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
||||||
err := grpc_prometheus.StreamServerInterceptor(srv, ss, info, handler)
|
err := grpc_prometheus.StreamServerInterceptor(srv, ss, info, handler)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
raven.CaptureError(err, nil)
|
sentry.CaptureException(err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
3
vendor/github.com/certifi/gocertifi/LICENSE
generated
vendored
3
vendor/github.com/certifi/gocertifi/LICENSE
generated
vendored
|
@ -1,3 +0,0 @@
|
||||||
This Source Code Form is subject to the terms of the Mozilla Public License,
|
|
||||||
v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain
|
|
||||||
one at http://mozilla.org/MPL/2.0/.
|
|
60
vendor/github.com/certifi/gocertifi/README.md
generated
vendored
60
vendor/github.com/certifi/gocertifi/README.md
generated
vendored
|
@ -1,60 +0,0 @@
|
||||||
# GoCertifi: SSL Certificates for Golang
|
|
||||||
|
|
||||||
This Go package contains a CA bundle that you can reference in your Go code.
|
|
||||||
This is useful for systems that do not have CA bundles that Golang can find
|
|
||||||
itself, or where a uniform set of CAs is valuable.
|
|
||||||
|
|
||||||
This is the same CA bundle that ships with the
|
|
||||||
[Python Requests](https://github.com/kennethreitz/requests) library, and is a
|
|
||||||
Golang specific port of [certifi](https://github.com/kennethreitz/certifi). The
|
|
||||||
CA bundle is derived from Mozilla's canonical set.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can use the `gocertifi` package as follows:
|
|
||||||
|
|
||||||
```go
|
|
||||||
import "github.com/certifi/gocertifi"
|
|
||||||
|
|
||||||
cert_pool, err := gocertifi.CACerts()
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use the returned `*x509.CertPool` as part of an HTTP transport, for example:
|
|
||||||
|
|
||||||
```go
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
"crypto/tls"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Setup an HTTP client with a custom transport
|
|
||||||
transport := &http.Transport{
|
|
||||||
TLSClientConfig: &tls.Config{RootCAs: cert_pool},
|
|
||||||
}
|
|
||||||
client := &http.Client{Transport: transport}
|
|
||||||
|
|
||||||
// Make an HTTP request using our custom transport
|
|
||||||
resp, err := client.Get("https://example.com")
|
|
||||||
```
|
|
||||||
|
|
||||||
## Detailed Documentation
|
|
||||||
|
|
||||||
Import as follows:
|
|
||||||
|
|
||||||
```go
|
|
||||||
import "github.com/certifi/gocertifi"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Errors
|
|
||||||
|
|
||||||
```go
|
|
||||||
var ErrParseFailed = errors.New("gocertifi: error when parsing certificates")
|
|
||||||
```
|
|
||||||
|
|
||||||
### Functions
|
|
||||||
|
|
||||||
```go
|
|
||||||
func CACerts() (*x509.CertPool, error)
|
|
||||||
```
|
|
||||||
CACerts builds an X.509 certificate pool containing the Mozilla CA Certificate
|
|
||||||
bundle. Returns nil on error along with an appropriate error code.
|
|
4680
vendor/github.com/certifi/gocertifi/certifi.go
generated
vendored
4680
vendor/github.com/certifi/gocertifi/certifi.go
generated
vendored
File diff suppressed because it is too large
Load diff
72
vendor/github.com/certifi/gocertifi/gen.go
generated
vendored
72
vendor/github.com/certifi/gocertifi/gen.go
generated
vendored
|
@ -1,72 +0,0 @@
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/x509"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"text/template"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
const url = "https://mkcert.org/generate/"
|
|
||||||
resp, err := http.Get(url)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
if resp.StatusCode != 200 {
|
|
||||||
log.Fatal("expected 200, got", resp.StatusCode)
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
bundle, err := ioutil.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
pool := x509.NewCertPool()
|
|
||||||
if !pool.AppendCertsFromPEM(bundle) {
|
|
||||||
log.Fatalf("can't parse cerficiates from %s", url)
|
|
||||||
}
|
|
||||||
|
|
||||||
fp, err := os.Create("certifi.go")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer fp.Close()
|
|
||||||
|
|
||||||
tmpl.Execute(fp, struct {
|
|
||||||
Timestamp time.Time
|
|
||||||
URL string
|
|
||||||
Bundle string
|
|
||||||
}{
|
|
||||||
Timestamp: time.Now(),
|
|
||||||
URL: url,
|
|
||||||
Bundle: string(bundle),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var tmpl = template.Must(template.New("").Parse(`// Code generated by go generate; DO NOT EDIT.
|
|
||||||
// {{ .Timestamp }}
|
|
||||||
// {{ .URL }}
|
|
||||||
|
|
||||||
package gocertifi
|
|
||||||
|
|
||||||
//go:generate go run gen.go
|
|
||||||
|
|
||||||
import "crypto/x509"
|
|
||||||
|
|
||||||
const pemcerts string = ` + "`" + `
|
|
||||||
{{ .Bundle }}
|
|
||||||
` + "`" + `
|
|
||||||
|
|
||||||
// CACerts builds an X.509 certificate pool containing the Mozilla CA
|
|
||||||
// Certificate bundle. Returns nil on error along with an appropriate error
|
|
||||||
// code.
|
|
||||||
func CACerts() (*x509.CertPool, error) {
|
|
||||||
pool := x509.NewCertPool()
|
|
||||||
pool.AppendCertsFromPEM([]byte(pemcerts))
|
|
||||||
return pool, nil
|
|
||||||
}
|
|
||||||
`))
|
|
1
vendor/github.com/getsentry/raven-go/.dockerignore
generated
vendored
1
vendor/github.com/getsentry/raven-go/.dockerignore
generated
vendored
|
@ -1 +0,0 @@
|
||||||
.git
|
|
5
vendor/github.com/getsentry/raven-go/.gitignore
generated
vendored
5
vendor/github.com/getsentry/raven-go/.gitignore
generated
vendored
|
@ -1,5 +0,0 @@
|
||||||
*.test
|
|
||||||
*.out
|
|
||||||
example/example
|
|
||||||
/xunit.xml
|
|
||||||
/coverage.xml
|
|
0
vendor/github.com/getsentry/raven-go/.gitmodules
generated
vendored
0
vendor/github.com/getsentry/raven-go/.gitmodules
generated
vendored
41
vendor/github.com/getsentry/raven-go/.travis.yml
generated
vendored
41
vendor/github.com/getsentry/raven-go/.travis.yml
generated
vendored
|
@ -1,41 +0,0 @@
|
||||||
sudo: false
|
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- 1.7.x
|
|
||||||
- 1.8.x
|
|
||||||
- 1.9.x
|
|
||||||
- 1.10.x
|
|
||||||
- 1.11.x
|
|
||||||
- tip
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- go install -race std
|
|
||||||
- go get golang.org/x/tools/cmd/cover
|
|
||||||
- go get github.com/tebeka/go2xunit
|
|
||||||
- go get github.com/t-yuki/gocover-cobertura
|
|
||||||
- go get -v ./...
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go test -v -race ./... | tee gotest.out
|
|
||||||
- $GOPATH/bin/go2xunit -fail -input gotest.out -output xunit.xml
|
|
||||||
- go test -v -coverprofile=coverage.txt -covermode count .
|
|
||||||
- $GOPATH/bin/gocover-cobertura < coverage.txt > coverage.xml
|
|
||||||
|
|
||||||
after_script:
|
|
||||||
- npm install -g @zeus-ci/cli
|
|
||||||
- zeus upload -t "application/x-cobertura+xml" coverage.xml
|
|
||||||
- zeus upload -t "application/x-xunit+xml" xunit.xml
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
webhooks:
|
|
||||||
urls:
|
|
||||||
- https://zeus.ci/hooks/cd949996-d30a-11e8-ba53-0a580a28042d/public/provider/travis/webhook
|
|
||||||
on_success: always
|
|
||||||
on_failure: always
|
|
||||||
on_start: always
|
|
||||||
on_cancel: always
|
|
||||||
on_error: always
|
|
28
vendor/github.com/getsentry/raven-go/LICENSE
generated
vendored
28
vendor/github.com/getsentry/raven-go/LICENSE
generated
vendored
|
@ -1,28 +0,0 @@
|
||||||
Copyright (c) 2013 Apollic Software, LLC. All rights reserved.
|
|
||||||
Copyright (c) 2015 Functional Software, Inc. All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
|
||||||
in the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
* Neither the name of Apollic Software, LLC nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
19
vendor/github.com/getsentry/raven-go/README.md
generated
vendored
19
vendor/github.com/getsentry/raven-go/README.md
generated
vendored
|
@ -1,19 +0,0 @@
|
||||||
# raven
|
|
||||||
|
|
||||||
[![Build Status](https://api.travis-ci.org/getsentry/raven-go.svg?branch=master)](https://travis-ci.org/getsentry/raven-go)
|
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/getsentry/raven-go)](https://goreportcard.com/report/github.com/getsentry/raven-go)
|
|
||||||
[![GoDoc](https://godoc.org/github.com/getsentry/raven-go?status.svg)](https://godoc.org/github.com/getsentry/raven-go)
|
|
||||||
|
|
||||||
raven is the official Go SDK for the [Sentry](https://github.com/getsentry/sentry)
|
|
||||||
event/error logging system.
|
|
||||||
|
|
||||||
- [**API Documentation**](https://godoc.org/github.com/getsentry/raven-go)
|
|
||||||
- [**Usage and Examples**](https://docs.sentry.io/clients/go/)
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```text
|
|
||||||
go get github.com/getsentry/raven-go
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: Go 1.7 and newer are supported.
|
|
977
vendor/github.com/getsentry/raven-go/client.go
generated
vendored
977
vendor/github.com/getsentry/raven-go/client.go
generated
vendored
|
@ -1,977 +0,0 @@
|
||||||
// Package raven implements a client for the Sentry error logging service.
|
|
||||||
package raven
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"compress/zlib"
|
|
||||||
"crypto/rand"
|
|
||||||
"crypto/tls"
|
|
||||||
"encoding/base64"
|
|
||||||
"encoding/hex"
|
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
mrand "math/rand"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/certifi/gocertifi"
|
|
||||||
pkgErrors "github.com/pkg/errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
userAgent = "raven-go/1.0"
|
|
||||||
timestampFormat = `"2006-01-02T15:04:05.00"`
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrPacketDropped = errors.New("raven: packet dropped")
|
|
||||||
ErrUnableToUnmarshalJSON = errors.New("raven: unable to unmarshal JSON")
|
|
||||||
ErrMissingUser = errors.New("raven: dsn missing public key and/or password")
|
|
||||||
ErrMissingProjectID = errors.New("raven: dsn missing project id")
|
|
||||||
ErrInvalidSampleRate = errors.New("raven: sample rate should be between 0 and 1")
|
|
||||||
)
|
|
||||||
|
|
||||||
type Severity string
|
|
||||||
|
|
||||||
// http://docs.python.org/2/howto/logging.html#logging-levels
|
|
||||||
const (
|
|
||||||
DEBUG = Severity("debug")
|
|
||||||
INFO = Severity("info")
|
|
||||||
WARNING = Severity("warning")
|
|
||||||
ERROR = Severity("error")
|
|
||||||
FATAL = Severity("fatal")
|
|
||||||
)
|
|
||||||
|
|
||||||
type Timestamp time.Time
|
|
||||||
|
|
||||||
func (t Timestamp) MarshalJSON() ([]byte, error) {
|
|
||||||
return []byte(time.Time(t).UTC().Format(timestampFormat)), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (timestamp *Timestamp) UnmarshalJSON(data []byte) error {
|
|
||||||
t, err := time.Parse(timestampFormat, string(data))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
*timestamp = Timestamp(t)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (timestamp Timestamp) Format(format string) string {
|
|
||||||
t := time.Time(timestamp)
|
|
||||||
return t.Format(format)
|
|
||||||
}
|
|
||||||
|
|
||||||
// An Interface is a Sentry interface that will be serialized as JSON.
|
|
||||||
// It must implement json.Marshaler or use json struct tags.
|
|
||||||
type Interface interface {
|
|
||||||
// The Sentry class name. Example: sentry.interfaces.Stacktrace
|
|
||||||
Class() string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Culpriter interface {
|
|
||||||
Culprit() string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Transport interface {
|
|
||||||
Send(url, authHeader string, packet *Packet) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type Extra map[string]interface{}
|
|
||||||
|
|
||||||
type outgoingPacket struct {
|
|
||||||
packet *Packet
|
|
||||||
ch chan error
|
|
||||||
}
|
|
||||||
|
|
||||||
type Tag struct {
|
|
||||||
Key string
|
|
||||||
Value string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Tags []Tag
|
|
||||||
|
|
||||||
func (tag *Tag) MarshalJSON() ([]byte, error) {
|
|
||||||
return json.Marshal([2]string{tag.Key, tag.Value})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Tag) UnmarshalJSON(data []byte) error {
|
|
||||||
var tag [2]string
|
|
||||||
if err := json.Unmarshal(data, &tag); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
*t = Tag{tag[0], tag[1]}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Tags) UnmarshalJSON(data []byte) error {
|
|
||||||
var tags []Tag
|
|
||||||
|
|
||||||
switch data[0] {
|
|
||||||
case '[':
|
|
||||||
// Unmarshal into []Tag
|
|
||||||
if err := json.Unmarshal(data, &tags); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
case '{':
|
|
||||||
// Unmarshal into map[string]string
|
|
||||||
tagMap := make(map[string]string)
|
|
||||||
if err := json.Unmarshal(data, &tagMap); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert to []Tag
|
|
||||||
for k, v := range tagMap {
|
|
||||||
tags = append(tags, Tag{k, v})
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return ErrUnableToUnmarshalJSON
|
|
||||||
}
|
|
||||||
|
|
||||||
*t = tags
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/#building-the-json-packet
|
|
||||||
type Packet struct {
|
|
||||||
// Required
|
|
||||||
Message string `json:"message"`
|
|
||||||
|
|
||||||
// Required, set automatically by Client.Send/Report via Packet.Init if blank
|
|
||||||
EventID string `json:"event_id"`
|
|
||||||
Project string `json:"project"`
|
|
||||||
Timestamp Timestamp `json:"timestamp"`
|
|
||||||
Level Severity `json:"level"`
|
|
||||||
Logger string `json:"logger"`
|
|
||||||
|
|
||||||
// Optional
|
|
||||||
Platform string `json:"platform,omitempty"`
|
|
||||||
Culprit string `json:"culprit,omitempty"`
|
|
||||||
ServerName string `json:"server_name,omitempty"`
|
|
||||||
Release string `json:"release,omitempty"`
|
|
||||||
Environment string `json:"environment,omitempty"`
|
|
||||||
Tags Tags `json:"tags,omitempty"`
|
|
||||||
Modules map[string]string `json:"modules,omitempty"`
|
|
||||||
Fingerprint []string `json:"fingerprint,omitempty"`
|
|
||||||
Extra Extra `json:"extra,omitempty"`
|
|
||||||
|
|
||||||
Interfaces []Interface `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewPacket constructs a packet with the specified message and interfaces.
|
|
||||||
func NewPacket(message string, interfaces ...Interface) *Packet {
|
|
||||||
extra := Extra{}
|
|
||||||
setExtraDefaults(extra)
|
|
||||||
return &Packet{
|
|
||||||
Message: message,
|
|
||||||
Interfaces: interfaces,
|
|
||||||
Extra: extra,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewPacketWithExtra constructs a packet with the specified message, extra information, and interfaces.
|
|
||||||
func NewPacketWithExtra(message string, extra Extra, interfaces ...Interface) *Packet {
|
|
||||||
if extra == nil {
|
|
||||||
extra = Extra{}
|
|
||||||
}
|
|
||||||
setExtraDefaults(extra)
|
|
||||||
|
|
||||||
return &Packet{
|
|
||||||
Message: message,
|
|
||||||
Interfaces: interfaces,
|
|
||||||
Extra: extra,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setExtraDefaults(extra Extra) Extra {
|
|
||||||
extra["runtime.Version"] = runtime.Version()
|
|
||||||
extra["runtime.NumCPU"] = runtime.NumCPU()
|
|
||||||
extra["runtime.GOMAXPROCS"] = runtime.GOMAXPROCS(0) // 0 just returns the current value
|
|
||||||
extra["runtime.NumGoroutine"] = runtime.NumGoroutine()
|
|
||||||
return extra
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init initializes required fields in a packet. It is typically called by
|
|
||||||
// Client.Send/Report automatically.
|
|
||||||
func (packet *Packet) Init(project string) error {
|
|
||||||
if packet.Project == "" {
|
|
||||||
packet.Project = project
|
|
||||||
}
|
|
||||||
if packet.EventID == "" {
|
|
||||||
var err error
|
|
||||||
packet.EventID, err = uuid()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if time.Time(packet.Timestamp).IsZero() {
|
|
||||||
packet.Timestamp = Timestamp(time.Now())
|
|
||||||
}
|
|
||||||
if packet.Level == "" {
|
|
||||||
packet.Level = ERROR
|
|
||||||
}
|
|
||||||
if packet.Logger == "" {
|
|
||||||
packet.Logger = "root"
|
|
||||||
}
|
|
||||||
if packet.ServerName == "" {
|
|
||||||
packet.ServerName = hostname
|
|
||||||
}
|
|
||||||
if packet.Platform == "" {
|
|
||||||
packet.Platform = "go"
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Culprit == "" {
|
|
||||||
for _, inter := range packet.Interfaces {
|
|
||||||
if c, ok := inter.(Culpriter); ok {
|
|
||||||
packet.Culprit = c.Culprit()
|
|
||||||
if packet.Culprit != "" {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (packet *Packet) AddTags(tags map[string]string) {
|
|
||||||
for k, v := range tags {
|
|
||||||
packet.Tags = append(packet.Tags, Tag{k, v})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func uuid() (string, error) {
|
|
||||||
id := make([]byte, 16)
|
|
||||||
_, err := io.ReadFull(rand.Reader, id)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
id[6] &= 0x0F // clear version
|
|
||||||
id[6] |= 0x40 // set version to 4 (random uuid)
|
|
||||||
id[8] &= 0x3F // clear variant
|
|
||||||
id[8] |= 0x80 // set to IETF variant
|
|
||||||
return hex.EncodeToString(id), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (packet *Packet) JSON() ([]byte, error) {
|
|
||||||
packetJSON, err := json.Marshal(packet)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
interfaces := make(map[string]Interface, len(packet.Interfaces))
|
|
||||||
for _, inter := range packet.Interfaces {
|
|
||||||
if inter != nil {
|
|
||||||
interfaces[inter.Class()] = inter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(interfaces) > 0 {
|
|
||||||
interfaceJSON, err := json.Marshal(interfaces)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
packetJSON[len(packetJSON)-1] = ','
|
|
||||||
packetJSON = append(packetJSON, interfaceJSON[1:]...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return packetJSON, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type context struct {
|
|
||||||
user *User
|
|
||||||
http *Http
|
|
||||||
tags map[string]string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *context) setUser(u *User) { c.user = u }
|
|
||||||
func (c *context) setHttp(h *Http) { c.http = h }
|
|
||||||
func (c *context) setTags(t map[string]string) {
|
|
||||||
if c.tags == nil {
|
|
||||||
c.tags = make(map[string]string)
|
|
||||||
}
|
|
||||||
for k, v := range t {
|
|
||||||
c.tags[k] = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (c *context) clear() {
|
|
||||||
c.user = nil
|
|
||||||
c.http = nil
|
|
||||||
c.tags = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return a list of interfaces to be used in appending with the rest
|
|
||||||
func (c *context) interfaces() []Interface {
|
|
||||||
len, i := 0, 0
|
|
||||||
if c.user != nil {
|
|
||||||
len++
|
|
||||||
}
|
|
||||||
if c.http != nil {
|
|
||||||
len++
|
|
||||||
}
|
|
||||||
interfaces := make([]Interface, len)
|
|
||||||
if c.user != nil {
|
|
||||||
interfaces[i] = c.user
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
if c.http != nil {
|
|
||||||
interfaces[i] = c.http
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
return interfaces
|
|
||||||
}
|
|
||||||
|
|
||||||
// The maximum number of packets that will be buffered waiting to be delivered.
|
|
||||||
// Packets will be dropped if the buffer is full. Used by NewClient.
|
|
||||||
var MaxQueueBuffer = 100
|
|
||||||
|
|
||||||
func newTransport() Transport {
|
|
||||||
t := &HTTPTransport{}
|
|
||||||
rootCAs, err := gocertifi.CACerts()
|
|
||||||
if err != nil {
|
|
||||||
log.Println("raven: failed to load root TLS certificates:", err)
|
|
||||||
} else {
|
|
||||||
t.Client = &http.Client{
|
|
||||||
Transport: &http.Transport{
|
|
||||||
Proxy: http.ProxyFromEnvironment,
|
|
||||||
TLSClientConfig: &tls.Config{RootCAs: rootCAs},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
|
|
||||||
func newClient(tags map[string]string) *Client {
|
|
||||||
client := &Client{
|
|
||||||
Transport: newTransport(),
|
|
||||||
Tags: tags,
|
|
||||||
context: &context{},
|
|
||||||
sampleRate: 1.0,
|
|
||||||
queue: make(chan *outgoingPacket, MaxQueueBuffer),
|
|
||||||
}
|
|
||||||
client.SetDSN(os.Getenv("SENTRY_DSN"))
|
|
||||||
client.SetRelease(os.Getenv("SENTRY_RELEASE"))
|
|
||||||
client.SetEnvironment(os.Getenv("SENTRY_ENVIRONMENT"))
|
|
||||||
return client
|
|
||||||
}
|
|
||||||
|
|
||||||
// New constructs a new Sentry client instance
|
|
||||||
func New(dsn string) (*Client, error) {
|
|
||||||
client := newClient(nil)
|
|
||||||
return client, client.SetDSN(dsn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewWithTags constructs a new Sentry client instance with default tags.
|
|
||||||
func NewWithTags(dsn string, tags map[string]string) (*Client, error) {
|
|
||||||
client := newClient(tags)
|
|
||||||
return client, client.SetDSN(dsn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewClient constructs a Sentry client and spawns a background goroutine to
|
|
||||||
// handle packets sent by Client.Report.
|
|
||||||
//
|
|
||||||
// Deprecated: use New and NewWithTags instead
|
|
||||||
func NewClient(dsn string, tags map[string]string) (*Client, error) {
|
|
||||||
client := newClient(tags)
|
|
||||||
return client, client.SetDSN(dsn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Client encapsulates a connection to a Sentry server. It must be initialized
|
|
||||||
// by calling NewClient. Modification of fields concurrently with Send or after
|
|
||||||
// calling Report for the first time is not thread-safe.
|
|
||||||
type Client struct {
|
|
||||||
Tags map[string]string
|
|
||||||
|
|
||||||
Transport Transport
|
|
||||||
|
|
||||||
// DropHandler is called when a packet is dropped because the buffer is full.
|
|
||||||
DropHandler func(*Packet)
|
|
||||||
|
|
||||||
// Context that will get appending to all packets
|
|
||||||
context *context
|
|
||||||
|
|
||||||
mu sync.RWMutex
|
|
||||||
url string
|
|
||||||
projectID string
|
|
||||||
authHeader string
|
|
||||||
release string
|
|
||||||
environment string
|
|
||||||
sampleRate float32
|
|
||||||
|
|
||||||
// default logger name (leave empty for 'root')
|
|
||||||
defaultLoggerName string
|
|
||||||
|
|
||||||
includePaths []string
|
|
||||||
ignoreErrorsRegexp *regexp.Regexp
|
|
||||||
queue chan *outgoingPacket
|
|
||||||
|
|
||||||
// A WaitGroup to keep track of all currently in-progress captures
|
|
||||||
// This is intended to be used with Client.Wait() to assure that
|
|
||||||
// all messages have been transported before exiting the process.
|
|
||||||
wg sync.WaitGroup
|
|
||||||
|
|
||||||
// A Once to track only starting up the background worker once
|
|
||||||
start sync.Once
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize a default *Client instance
|
|
||||||
var DefaultClient = newClient(nil)
|
|
||||||
|
|
||||||
func (c *Client) SetIgnoreErrors(errs []string) error {
|
|
||||||
joinedRegexp := strings.Join(errs, "|")
|
|
||||||
r, err := regexp.Compile(joinedRegexp)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to compile regexp %q for %q: %v", joinedRegexp, errs, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.mu.Lock()
|
|
||||||
c.ignoreErrorsRegexp = r
|
|
||||||
c.mu.Unlock()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) shouldExcludeErr(errStr string) bool {
|
|
||||||
c.mu.RLock()
|
|
||||||
defer c.mu.RUnlock()
|
|
||||||
return c.ignoreErrorsRegexp != nil && c.ignoreErrorsRegexp.MatchString(errStr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetIgnoreErrors(errs ...string) error {
|
|
||||||
return DefaultClient.SetIgnoreErrors(errs)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetDSN updates a client with a new DSN. It safe to call after and
|
|
||||||
// concurrently with calls to Report and Send.
|
|
||||||
func (client *Client) SetDSN(dsn string) error {
|
|
||||||
if dsn == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
client.mu.Lock()
|
|
||||||
defer client.mu.Unlock()
|
|
||||||
|
|
||||||
uri, err := url.Parse(dsn)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if uri.User == nil {
|
|
||||||
return ErrMissingUser
|
|
||||||
}
|
|
||||||
publicKey := uri.User.Username()
|
|
||||||
secretKey, hasSecretKey := uri.User.Password()
|
|
||||||
uri.User = nil
|
|
||||||
|
|
||||||
if idx := strings.LastIndex(uri.Path, "/"); idx != -1 {
|
|
||||||
client.projectID = uri.Path[idx+1:]
|
|
||||||
uri.Path = uri.Path[:idx+1] + "api/" + client.projectID + "/store/"
|
|
||||||
}
|
|
||||||
if client.projectID == "" {
|
|
||||||
return ErrMissingProjectID
|
|
||||||
}
|
|
||||||
|
|
||||||
client.url = uri.String()
|
|
||||||
|
|
||||||
if hasSecretKey {
|
|
||||||
client.authHeader = fmt.Sprintf("Sentry sentry_version=4, sentry_key=%s, sentry_secret=%s", publicKey, secretKey)
|
|
||||||
} else {
|
|
||||||
client.authHeader = fmt.Sprintf("Sentry sentry_version=4, sentry_key=%s", publicKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sets the DSN for the default *Client instance
|
|
||||||
func SetDSN(dsn string) error { return DefaultClient.SetDSN(dsn) }
|
|
||||||
|
|
||||||
// SetRelease sets the "release" tag.
|
|
||||||
func (client *Client) SetRelease(release string) {
|
|
||||||
client.mu.Lock()
|
|
||||||
defer client.mu.Unlock()
|
|
||||||
client.release = release
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetEnvironment sets the "environment" tag.
|
|
||||||
func (client *Client) SetEnvironment(environment string) {
|
|
||||||
client.mu.Lock()
|
|
||||||
defer client.mu.Unlock()
|
|
||||||
client.environment = environment
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetDefaultLoggerName sets the default logger name.
|
|
||||||
func (client *Client) SetDefaultLoggerName(name string) {
|
|
||||||
client.mu.Lock()
|
|
||||||
defer client.mu.Unlock()
|
|
||||||
client.defaultLoggerName = name
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetSampleRate sets how much sampling we want on client side
|
|
||||||
func (client *Client) SetSampleRate(rate float32) error {
|
|
||||||
client.mu.Lock()
|
|
||||||
defer client.mu.Unlock()
|
|
||||||
|
|
||||||
if rate < 0 || rate > 1 {
|
|
||||||
return ErrInvalidSampleRate
|
|
||||||
}
|
|
||||||
client.sampleRate = rate
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetRelease sets the "release" tag on the default *Client
|
|
||||||
func SetRelease(release string) { DefaultClient.SetRelease(release) }
|
|
||||||
|
|
||||||
// SetEnvironment sets the "environment" tag on the default *Client
|
|
||||||
func SetEnvironment(environment string) { DefaultClient.SetEnvironment(environment) }
|
|
||||||
|
|
||||||
// SetDefaultLoggerName sets the "defaultLoggerName" on the default *Client
|
|
||||||
func SetDefaultLoggerName(name string) {
|
|
||||||
DefaultClient.SetDefaultLoggerName(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetSampleRate sets the "sample rate" on the degault *Client
|
|
||||||
func SetSampleRate(rate float32) error { return DefaultClient.SetSampleRate(rate) }
|
|
||||||
|
|
||||||
func (client *Client) worker() {
|
|
||||||
for outgoingPacket := range client.queue {
|
|
||||||
|
|
||||||
client.mu.RLock()
|
|
||||||
url, authHeader := client.url, client.authHeader
|
|
||||||
client.mu.RUnlock()
|
|
||||||
|
|
||||||
outgoingPacket.ch <- client.Transport.Send(url, authHeader, outgoingPacket.packet)
|
|
||||||
client.wg.Done()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Capture asynchronously delivers a packet to the Sentry server. It is a no-op
|
|
||||||
// when client is nil. A channel is provided if it is important to check for a
|
|
||||||
// send's success.
|
|
||||||
func (client *Client) Capture(packet *Packet, captureTags map[string]string) (eventID string, ch chan error) {
|
|
||||||
ch = make(chan error, 1)
|
|
||||||
|
|
||||||
if client == nil {
|
|
||||||
// return a chan that always returns nil when the caller receives from it
|
|
||||||
close(ch)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if client.sampleRate < 1.0 && mrand.Float32() > client.sampleRate {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet == nil {
|
|
||||||
close(ch)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if client.shouldExcludeErr(packet.Message) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep track of all running Captures so that we can wait for them all to finish
|
|
||||||
// *Must* call client.wg.Done() on any path that indicates that an event was
|
|
||||||
// finished being acted upon, whether success or failure
|
|
||||||
client.wg.Add(1)
|
|
||||||
|
|
||||||
// Merge capture tags and client tags
|
|
||||||
packet.AddTags(captureTags)
|
|
||||||
packet.AddTags(client.Tags)
|
|
||||||
|
|
||||||
// Initialize any required packet fields
|
|
||||||
client.mu.RLock()
|
|
||||||
packet.AddTags(client.context.tags)
|
|
||||||
projectID := client.projectID
|
|
||||||
release := client.release
|
|
||||||
environment := client.environment
|
|
||||||
defaultLoggerName := client.defaultLoggerName
|
|
||||||
client.mu.RUnlock()
|
|
||||||
|
|
||||||
// set the global logger name on the packet if we must
|
|
||||||
if packet.Logger == "" && defaultLoggerName != "" {
|
|
||||||
packet.Logger = defaultLoggerName
|
|
||||||
}
|
|
||||||
|
|
||||||
err := packet.Init(projectID)
|
|
||||||
if err != nil {
|
|
||||||
ch <- err
|
|
||||||
client.wg.Done()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Release == "" {
|
|
||||||
packet.Release = release
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Environment == "" {
|
|
||||||
packet.Environment = environment
|
|
||||||
}
|
|
||||||
|
|
||||||
outgoingPacket := &outgoingPacket{packet, ch}
|
|
||||||
|
|
||||||
// Lazily start background worker until we
|
|
||||||
// do our first write into the queue.
|
|
||||||
client.start.Do(func() {
|
|
||||||
go client.worker()
|
|
||||||
})
|
|
||||||
|
|
||||||
select {
|
|
||||||
case client.queue <- outgoingPacket:
|
|
||||||
default:
|
|
||||||
// Send would block, drop the packet
|
|
||||||
if client.DropHandler != nil {
|
|
||||||
client.DropHandler(packet)
|
|
||||||
}
|
|
||||||
ch <- ErrPacketDropped
|
|
||||||
client.wg.Done()
|
|
||||||
}
|
|
||||||
|
|
||||||
return packet.EventID, ch
|
|
||||||
}
|
|
||||||
|
|
||||||
// Capture asynchronously delivers a packet to the Sentry server with the default *Client.
|
|
||||||
// It is a no-op when client is nil. A channel is provided if it is important to check for a
|
|
||||||
// send's success.
|
|
||||||
func Capture(packet *Packet, captureTags map[string]string) (eventID string, ch chan error) {
|
|
||||||
return DefaultClient.Capture(packet, captureTags)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureMessage formats and delivers a string message to the Sentry server.
|
|
||||||
func (client *Client) CaptureMessage(message string, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
if client == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if client.shouldExcludeErr(message) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
packet := NewPacket(message, append(append(interfaces, client.context.interfaces()...), &Message{message, nil})...)
|
|
||||||
eventID, _ := client.Capture(packet, tags)
|
|
||||||
|
|
||||||
return eventID
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureMessage formats and delivers a string message to the Sentry server with the default *Client
|
|
||||||
func CaptureMessage(message string, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
return DefaultClient.CaptureMessage(message, tags, interfaces...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureMessageAndWait is identical to CaptureMessage except it blocks and waits for the message to be sent.
|
|
||||||
func (client *Client) CaptureMessageAndWait(message string, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
if client == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if client.shouldExcludeErr(message) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
packet := NewPacket(message, append(append(interfaces, client.context.interfaces()...), &Message{message, nil})...)
|
|
||||||
eventID, ch := client.Capture(packet, tags)
|
|
||||||
if eventID != "" {
|
|
||||||
<-ch
|
|
||||||
}
|
|
||||||
|
|
||||||
return eventID
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureMessageAndWait is identical to CaptureMessage except it blocks and waits for the message to be sent.
|
|
||||||
func CaptureMessageAndWait(message string, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
return DefaultClient.CaptureMessageAndWait(message, tags, interfaces...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureErrors formats and delivers an error to the Sentry server.
|
|
||||||
// Adds a stacktrace to the packet, excluding the call to this method.
|
|
||||||
func (client *Client) CaptureError(err error, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
if client == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if client.shouldExcludeErr(err.Error()) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
extra := extractExtra(err)
|
|
||||||
cause := pkgErrors.Cause(err)
|
|
||||||
|
|
||||||
packet := NewPacketWithExtra(err.Error(), extra, append(append(interfaces, client.context.interfaces()...), NewException(cause, GetOrNewStacktrace(cause, 1, 3, client.includePaths)))...)
|
|
||||||
eventID, _ := client.Capture(packet, tags)
|
|
||||||
|
|
||||||
return eventID
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureErrors formats and delivers an error to the Sentry server using the default *Client.
|
|
||||||
// Adds a stacktrace to the packet, excluding the call to this method.
|
|
||||||
func CaptureError(err error, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
return DefaultClient.CaptureError(err, tags, interfaces...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureErrorAndWait is identical to CaptureError, except it blocks and assures that the event was sent
|
|
||||||
func (client *Client) CaptureErrorAndWait(err error, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
if client == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if client.shouldExcludeErr(err.Error()) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
extra := extractExtra(err)
|
|
||||||
cause := pkgErrors.Cause(err)
|
|
||||||
|
|
||||||
packet := NewPacketWithExtra(err.Error(), extra, append(append(interfaces, client.context.interfaces()...), NewException(cause, GetOrNewStacktrace(cause, 1, 3, client.includePaths)))...)
|
|
||||||
eventID, ch := client.Capture(packet, tags)
|
|
||||||
if eventID != "" {
|
|
||||||
<-ch
|
|
||||||
}
|
|
||||||
|
|
||||||
return eventID
|
|
||||||
}
|
|
||||||
|
|
||||||
// CaptureErrorAndWait is identical to CaptureError, except it blocks and assures that the event was sent
|
|
||||||
func CaptureErrorAndWait(err error, tags map[string]string, interfaces ...Interface) string {
|
|
||||||
return DefaultClient.CaptureErrorAndWait(err, tags, interfaces...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CapturePanic calls f and then recovers and reports a panic to the Sentry server if it occurs.
|
|
||||||
// If an error is captured, both the error and the reported Sentry error ID are returned.
|
|
||||||
func (client *Client) CapturePanic(f func(), tags map[string]string, interfaces ...Interface) (err interface{}, errorID string) {
|
|
||||||
// Note: This doesn't need to check for client, because we still want to go through the defer/recover path
|
|
||||||
// Down the line, Capture will be noop'd, so while this does a _tiny_ bit of overhead constructing the
|
|
||||||
// *Packet just to be thrown away, this should not be the normal case. Could be refactored to
|
|
||||||
// be completely noop though if we cared.
|
|
||||||
defer func() {
|
|
||||||
var packet *Packet
|
|
||||||
err = recover()
|
|
||||||
switch rval := err.(type) {
|
|
||||||
case nil:
|
|
||||||
return
|
|
||||||
case error:
|
|
||||||
if client.shouldExcludeErr(rval.Error()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
packet = NewPacket(rval.Error(), append(append(interfaces, client.context.interfaces()...), NewException(rval, NewStacktrace(2, 3, client.includePaths)))...)
|
|
||||||
default:
|
|
||||||
rvalStr := fmt.Sprint(rval)
|
|
||||||
if client.shouldExcludeErr(rvalStr) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
packet = NewPacket(rvalStr, append(append(interfaces, client.context.interfaces()...), NewException(errors.New(rvalStr), NewStacktrace(2, 3, client.includePaths)))...)
|
|
||||||
}
|
|
||||||
|
|
||||||
errorID, _ = client.Capture(packet, tags)
|
|
||||||
}()
|
|
||||||
|
|
||||||
f()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CapturePanic calls f and then recovers and reports a panic to the Sentry server if it occurs.
|
|
||||||
// If an error is captured, both the error and the reported Sentry error ID are returned.
|
|
||||||
func CapturePanic(f func(), tags map[string]string, interfaces ...Interface) (interface{}, string) {
|
|
||||||
return DefaultClient.CapturePanic(f, tags, interfaces...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CapturePanicAndWait is identical to CaptureError, except it blocks and assures that the event was sent
|
|
||||||
func (client *Client) CapturePanicAndWait(f func(), tags map[string]string, interfaces ...Interface) (err interface{}, errorID string) {
|
|
||||||
// Note: This doesn't need to check for client, because we still want to go through the defer/recover path
|
|
||||||
// Down the line, Capture will be noop'd, so while this does a _tiny_ bit of overhead constructing the
|
|
||||||
// *Packet just to be thrown away, this should not be the normal case. Could be refactored to
|
|
||||||
// be completely noop though if we cared.
|
|
||||||
defer func() {
|
|
||||||
var packet *Packet
|
|
||||||
err = recover()
|
|
||||||
switch rval := err.(type) {
|
|
||||||
case nil:
|
|
||||||
return
|
|
||||||
case error:
|
|
||||||
if client.shouldExcludeErr(rval.Error()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
packet = NewPacket(rval.Error(), append(append(interfaces, client.context.interfaces()...), NewException(rval, NewStacktrace(2, 3, client.includePaths)))...)
|
|
||||||
default:
|
|
||||||
rvalStr := fmt.Sprint(rval)
|
|
||||||
if client.shouldExcludeErr(rvalStr) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
packet = NewPacket(rvalStr, append(append(interfaces, client.context.interfaces()...), NewException(errors.New(rvalStr), NewStacktrace(2, 3, client.includePaths)))...)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ch chan error
|
|
||||||
errorID, ch = client.Capture(packet, tags)
|
|
||||||
if errorID != "" {
|
|
||||||
<-ch
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
f()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CapturePanicAndWait is identical to CaptureError, except it blocks and assures that the event was sent
|
|
||||||
func CapturePanicAndWait(f func(), tags map[string]string, interfaces ...Interface) (interface{}, string) {
|
|
||||||
return DefaultClient.CapturePanicAndWait(f, tags, interfaces...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (client *Client) Close() {
|
|
||||||
close(client.queue)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Close() { DefaultClient.Close() }
|
|
||||||
|
|
||||||
// Wait blocks and waits for all events to finish being sent to Sentry server
|
|
||||||
func (client *Client) Wait() {
|
|
||||||
client.wg.Wait()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait blocks and waits for all events to finish being sent to Sentry server
|
|
||||||
func Wait() { DefaultClient.Wait() }
|
|
||||||
|
|
||||||
func (client *Client) URL() string {
|
|
||||||
client.mu.RLock()
|
|
||||||
defer client.mu.RUnlock()
|
|
||||||
|
|
||||||
return client.url
|
|
||||||
}
|
|
||||||
|
|
||||||
func URL() string { return DefaultClient.URL() }
|
|
||||||
|
|
||||||
func (client *Client) ProjectID() string {
|
|
||||||
client.mu.RLock()
|
|
||||||
defer client.mu.RUnlock()
|
|
||||||
|
|
||||||
return client.projectID
|
|
||||||
}
|
|
||||||
|
|
||||||
func ProjectID() string { return DefaultClient.ProjectID() }
|
|
||||||
|
|
||||||
func (client *Client) Release() string {
|
|
||||||
client.mu.RLock()
|
|
||||||
defer client.mu.RUnlock()
|
|
||||||
|
|
||||||
return client.release
|
|
||||||
}
|
|
||||||
|
|
||||||
func Release() string { return DefaultClient.Release() }
|
|
||||||
|
|
||||||
func IncludePaths() []string { return DefaultClient.IncludePaths() }
|
|
||||||
|
|
||||||
func (client *Client) IncludePaths() []string {
|
|
||||||
client.mu.RLock()
|
|
||||||
defer client.mu.RUnlock()
|
|
||||||
|
|
||||||
return client.includePaths
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetIncludePaths(p []string) { DefaultClient.SetIncludePaths(p) }
|
|
||||||
|
|
||||||
func (client *Client) SetIncludePaths(p []string) {
|
|
||||||
client.mu.Lock()
|
|
||||||
defer client.mu.Unlock()
|
|
||||||
|
|
||||||
client.includePaths = p
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) SetUserContext(u *User) {
|
|
||||||
c.mu.Lock()
|
|
||||||
defer c.mu.Unlock()
|
|
||||||
c.context.setUser(u)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) SetHttpContext(h *Http) {
|
|
||||||
c.mu.Lock()
|
|
||||||
defer c.mu.Unlock()
|
|
||||||
c.context.setHttp(h)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) SetTagsContext(t map[string]string) {
|
|
||||||
c.mu.Lock()
|
|
||||||
defer c.mu.Unlock()
|
|
||||||
c.context.setTags(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) ClearContext() {
|
|
||||||
c.mu.Lock()
|
|
||||||
defer c.mu.Unlock()
|
|
||||||
c.context.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetUserContext(u *User) { DefaultClient.SetUserContext(u) }
|
|
||||||
func SetHttpContext(h *Http) { DefaultClient.SetHttpContext(h) }
|
|
||||||
func SetTagsContext(t map[string]string) { DefaultClient.SetTagsContext(t) }
|
|
||||||
func ClearContext() { DefaultClient.ClearContext() }
|
|
||||||
|
|
||||||
// HTTPTransport is the default transport, delivering packets to Sentry via the
|
|
||||||
// HTTP API.
|
|
||||||
type HTTPTransport struct {
|
|
||||||
*http.Client
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *HTTPTransport) Send(url, authHeader string, packet *Packet) error {
|
|
||||||
if url == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
body, contentType, err := serializedPacket(packet)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error serializing packet: %v", err)
|
|
||||||
}
|
|
||||||
req, err := http.NewRequest("POST", url, body)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("can't create new request: %v", err)
|
|
||||||
}
|
|
||||||
req.Header.Set("X-Sentry-Auth", authHeader)
|
|
||||||
req.Header.Set("User-Agent", userAgent)
|
|
||||||
req.Header.Set("Content-Type", contentType)
|
|
||||||
res, err := t.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
io.Copy(ioutil.Discard, res.Body)
|
|
||||||
res.Body.Close()
|
|
||||||
if res.StatusCode != 200 {
|
|
||||||
return fmt.Errorf("raven: got http status %d - x-sentry-error: %s", res.StatusCode, res.Header.Get("X-Sentry-Error"))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func serializedPacket(packet *Packet) (io.Reader, string, error) {
|
|
||||||
packetJSON, err := packet.JSON()
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", fmt.Errorf("error marshaling packet %+v to JSON: %v", packet, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only deflate/base64 the packet if it is bigger than 1KB, as there is
|
|
||||||
// overhead.
|
|
||||||
if len(packetJSON) > 1000 {
|
|
||||||
buf := &bytes.Buffer{}
|
|
||||||
b64 := base64.NewEncoder(base64.StdEncoding, buf)
|
|
||||||
deflate, _ := zlib.NewWriterLevel(b64, zlib.BestCompression)
|
|
||||||
deflate.Write(packetJSON)
|
|
||||||
deflate.Close()
|
|
||||||
b64.Close()
|
|
||||||
return buf, "application/octet-stream", nil
|
|
||||||
}
|
|
||||||
return bytes.NewReader(packetJSON), "application/json", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var hostname string
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
hostname, _ = os.Hostname()
|
|
||||||
}
|
|
60
vendor/github.com/getsentry/raven-go/errors.go
generated
vendored
60
vendor/github.com/getsentry/raven-go/errors.go
generated
vendored
|
@ -1,60 +0,0 @@
|
||||||
package raven
|
|
||||||
|
|
||||||
type causer interface {
|
|
||||||
Cause() error
|
|
||||||
}
|
|
||||||
|
|
||||||
type errWrappedWithExtra struct {
|
|
||||||
err error
|
|
||||||
extraInfo map[string]interface{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ewx *errWrappedWithExtra) Error() string {
|
|
||||||
return ewx.err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ewx *errWrappedWithExtra) Cause() error {
|
|
||||||
return ewx.err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ewx *errWrappedWithExtra) ExtraInfo() Extra {
|
|
||||||
return ewx.extraInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds extra data to an error before reporting to Sentry
|
|
||||||
func WrapWithExtra(err error, extraInfo map[string]interface{}) error {
|
|
||||||
return &errWrappedWithExtra{
|
|
||||||
err: err,
|
|
||||||
extraInfo: extraInfo,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type ErrWithExtra interface {
|
|
||||||
Error() string
|
|
||||||
Cause() error
|
|
||||||
ExtraInfo() Extra
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iteratively fetches all the Extra data added to an error,
|
|
||||||
// and it's underlying errors. Extra data defined first is
|
|
||||||
// respected, and is not overridden when extracting.
|
|
||||||
func extractExtra(err error) Extra {
|
|
||||||
extra := Extra{}
|
|
||||||
|
|
||||||
currentErr := err
|
|
||||||
for currentErr != nil {
|
|
||||||
if errWithExtra, ok := currentErr.(ErrWithExtra); ok {
|
|
||||||
for k, v := range errWithExtra.ExtraInfo() {
|
|
||||||
extra[k] = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if errWithCause, ok := currentErr.(causer); ok {
|
|
||||||
currentErr = errWithCause.Cause()
|
|
||||||
} else {
|
|
||||||
currentErr = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return extra
|
|
||||||
}
|
|
50
vendor/github.com/getsentry/raven-go/exception.go
generated
vendored
50
vendor/github.com/getsentry/raven-go/exception.go
generated
vendored
|
@ -1,50 +0,0 @@
|
||||||
package raven
|
|
||||||
|
|
||||||
import (
|
|
||||||
"reflect"
|
|
||||||
"regexp"
|
|
||||||
)
|
|
||||||
|
|
||||||
var errorMsgPattern = regexp.MustCompile(`\A(\w+): (.+)\z`)
|
|
||||||
|
|
||||||
func NewException(err error, stacktrace *Stacktrace) *Exception {
|
|
||||||
msg := err.Error()
|
|
||||||
ex := &Exception{
|
|
||||||
Stacktrace: stacktrace,
|
|
||||||
Value: msg,
|
|
||||||
Type: reflect.TypeOf(err).String(),
|
|
||||||
}
|
|
||||||
if m := errorMsgPattern.FindStringSubmatch(msg); m != nil {
|
|
||||||
ex.Module, ex.Value = m[1], m[2]
|
|
||||||
}
|
|
||||||
return ex
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/interfaces/#failure-interfaces
|
|
||||||
type Exception struct {
|
|
||||||
// Required
|
|
||||||
Value string `json:"value"`
|
|
||||||
|
|
||||||
// Optional
|
|
||||||
Type string `json:"type,omitempty"`
|
|
||||||
Module string `json:"module,omitempty"`
|
|
||||||
Stacktrace *Stacktrace `json:"stacktrace,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *Exception) Class() string { return "exception" }
|
|
||||||
|
|
||||||
func (e *Exception) Culprit() string {
|
|
||||||
if e.Stacktrace == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return e.Stacktrace.Culprit()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exceptions allows for chained errors
|
|
||||||
// https://docs.sentry.io/clientdev/interfaces/exception/
|
|
||||||
type Exceptions struct {
|
|
||||||
// Required
|
|
||||||
Values []*Exception `json:"values"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (es Exceptions) Class() string { return "exception" }
|
|
99
vendor/github.com/getsentry/raven-go/http.go
generated
vendored
99
vendor/github.com/getsentry/raven-go/http.go
generated
vendored
|
@ -1,99 +0,0 @@
|
||||||
package raven
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"net"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"runtime/debug"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewHttp(req *http.Request) *Http {
|
|
||||||
proto := "http"
|
|
||||||
if req.TLS != nil || req.Header.Get("X-Forwarded-Proto") == "https" {
|
|
||||||
proto = "https"
|
|
||||||
}
|
|
||||||
h := &Http{
|
|
||||||
Method: req.Method,
|
|
||||||
Cookies: req.Header.Get("Cookie"),
|
|
||||||
Query: sanitizeQuery(req.URL.Query()).Encode(),
|
|
||||||
URL: proto + "://" + req.Host + req.URL.Path,
|
|
||||||
Headers: make(map[string]string, len(req.Header)),
|
|
||||||
}
|
|
||||||
if addr, port, err := net.SplitHostPort(req.RemoteAddr); err == nil {
|
|
||||||
h.Env = map[string]string{"REMOTE_ADDR": addr, "REMOTE_PORT": port}
|
|
||||||
}
|
|
||||||
for k, v := range req.Header {
|
|
||||||
h.Headers[k] = strings.Join(v, ",")
|
|
||||||
}
|
|
||||||
h.Headers["Host"] = req.Host
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
var querySecretFields = []string{"password", "passphrase", "passwd", "secret"}
|
|
||||||
|
|
||||||
func sanitizeQuery(query url.Values) url.Values {
|
|
||||||
for _, keyword := range querySecretFields {
|
|
||||||
for field := range query {
|
|
||||||
if strings.Contains(field, keyword) {
|
|
||||||
query[field] = []string{"********"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return query
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/interfaces/#context-interfaces
|
|
||||||
type Http struct {
|
|
||||||
// Required
|
|
||||||
URL string `json:"url"`
|
|
||||||
Method string `json:"method"`
|
|
||||||
Query string `json:"query_string,omitempty"`
|
|
||||||
|
|
||||||
// Optional
|
|
||||||
Cookies string `json:"cookies,omitempty"`
|
|
||||||
Headers map[string]string `json:"headers,omitempty"`
|
|
||||||
Env map[string]string `json:"env,omitempty"`
|
|
||||||
|
|
||||||
// Must be either a string or map[string]string
|
|
||||||
Data interface{} `json:"data,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *Http) Class() string { return "request" }
|
|
||||||
|
|
||||||
// Recovery handler to wrap the stdlib net/http Mux.
|
|
||||||
// Example:
|
|
||||||
// http.HandleFunc("/", raven.RecoveryHandler(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
// ...
|
|
||||||
// }))
|
|
||||||
func RecoveryHandler(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {
|
|
||||||
return Recoverer(http.HandlerFunc(handler)).ServeHTTP
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recovery handler to wrap the stdlib net/http Mux.
|
|
||||||
// Example:
|
|
||||||
// mux := http.NewServeMux
|
|
||||||
// ...
|
|
||||||
// http.Handle("/", raven.Recoverer(mux))
|
|
||||||
func Recoverer(handler http.Handler) http.Handler {
|
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
defer func() {
|
|
||||||
if rval := recover(); rval != nil {
|
|
||||||
debug.PrintStack()
|
|
||||||
rvalStr := fmt.Sprint(rval)
|
|
||||||
var packet *Packet
|
|
||||||
if err, ok := rval.(error); ok {
|
|
||||||
packet = NewPacket(rvalStr, NewException(errors.New(rvalStr), GetOrNewStacktrace(err, 2, 3, nil)), NewHttp(r))
|
|
||||||
} else {
|
|
||||||
packet = NewPacket(rvalStr, NewException(errors.New(rvalStr), NewStacktrace(2, 3, nil)), NewHttp(r))
|
|
||||||
}
|
|
||||||
Capture(packet, nil)
|
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
handler.ServeHTTP(w, r)
|
|
||||||
})
|
|
||||||
}
|
|
49
vendor/github.com/getsentry/raven-go/interfaces.go
generated
vendored
49
vendor/github.com/getsentry/raven-go/interfaces.go
generated
vendored
|
@ -1,49 +0,0 @@
|
||||||
package raven
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/interfaces/#message-interface
|
|
||||||
type Message struct {
|
|
||||||
// Required
|
|
||||||
Message string `json:"message"`
|
|
||||||
|
|
||||||
// Optional
|
|
||||||
Params []interface{} `json:"params,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Message) Class() string { return "logentry" }
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/interfaces/#template-interface
|
|
||||||
type Template struct {
|
|
||||||
// Required
|
|
||||||
Filename string `json:"filename"`
|
|
||||||
Lineno int `json:"lineno"`
|
|
||||||
ContextLine string `json:"context_line"`
|
|
||||||
|
|
||||||
// Optional
|
|
||||||
PreContext []string `json:"pre_context,omitempty"`
|
|
||||||
PostContext []string `json:"post_context,omitempty"`
|
|
||||||
AbsolutePath string `json:"abs_path,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Template) Class() string { return "template" }
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/interfaces/#context-interfaces
|
|
||||||
type User struct {
|
|
||||||
// All fields are optional
|
|
||||||
ID string `json:"id,omitempty"`
|
|
||||||
Username string `json:"username,omitempty"`
|
|
||||||
Email string `json:"email,omitempty"`
|
|
||||||
IP string `json:"ip_address,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *User) Class() string { return "user" }
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/interfaces/#context-interfaces
|
|
||||||
type Query struct {
|
|
||||||
// Required
|
|
||||||
Query string `json:"query"`
|
|
||||||
|
|
||||||
// Optional
|
|
||||||
Engine string `json:"engine,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Query) Class() string { return "query" }
|
|
4
vendor/github.com/getsentry/raven-go/runtests.sh
generated
vendored
4
vendor/github.com/getsentry/raven-go/runtests.sh
generated
vendored
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
go test -race ./...
|
|
||||||
go test -cover ./...
|
|
||||||
go test -v ./...
|
|
277
vendor/github.com/getsentry/raven-go/stacktrace.go
generated
vendored
277
vendor/github.com/getsentry/raven-go/stacktrace.go
generated
vendored
|
@ -1,277 +0,0 @@
|
||||||
// Copyright 2011 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
// Some code from the runtime/debug package of the Go standard library.
|
|
||||||
|
|
||||||
package raven
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"go/build"
|
|
||||||
"io/ioutil"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
// https://docs.getsentry.com/hosted/clientdev/interfaces/#failure-interfaces
|
|
||||||
type Stacktrace struct {
|
|
||||||
// Required
|
|
||||||
Frames []*StacktraceFrame `json:"frames"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Stacktrace) Class() string { return "stacktrace" }
|
|
||||||
|
|
||||||
func (s *Stacktrace) Culprit() string {
|
|
||||||
for i := len(s.Frames) - 1; i >= 0; i-- {
|
|
||||||
frame := s.Frames[i]
|
|
||||||
if frame.InApp == true && frame.Module != "" && frame.Function != "" {
|
|
||||||
return frame.Module + "." + frame.Function
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type StacktraceFrame struct {
|
|
||||||
// At least one required
|
|
||||||
Filename string `json:"filename,omitempty"`
|
|
||||||
Function string `json:"function,omitempty"`
|
|
||||||
Module string `json:"module,omitempty"`
|
|
||||||
|
|
||||||
// Optional
|
|
||||||
Lineno int `json:"lineno,omitempty"`
|
|
||||||
Colno int `json:"colno,omitempty"`
|
|
||||||
AbsolutePath string `json:"abs_path,omitempty"`
|
|
||||||
ContextLine string `json:"context_line,omitempty"`
|
|
||||||
PreContext []string `json:"pre_context,omitempty"`
|
|
||||||
PostContext []string `json:"post_context,omitempty"`
|
|
||||||
InApp bool `json:"in_app"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to get stacktrace from err as an interface of github.com/pkg/errors, or else NewStacktrace()
|
|
||||||
func GetOrNewStacktrace(err error, skip int, context int, appPackagePrefixes []string) *Stacktrace {
|
|
||||||
stacktracer, errHasStacktrace := err.(interface {
|
|
||||||
StackTrace() errors.StackTrace
|
|
||||||
})
|
|
||||||
if errHasStacktrace {
|
|
||||||
var frames []*StacktraceFrame
|
|
||||||
for _, f := range stacktracer.StackTrace() {
|
|
||||||
pc := uintptr(f) - 1
|
|
||||||
fn := runtime.FuncForPC(pc)
|
|
||||||
var fName string
|
|
||||||
var file string
|
|
||||||
var line int
|
|
||||||
if fn != nil {
|
|
||||||
file, line = fn.FileLine(pc)
|
|
||||||
fName = fn.Name()
|
|
||||||
} else {
|
|
||||||
file = "unknown"
|
|
||||||
fName = "unknown"
|
|
||||||
}
|
|
||||||
frame := NewStacktraceFrame(pc, fName, file, line, context, appPackagePrefixes)
|
|
||||||
if frame != nil {
|
|
||||||
frames = append([]*StacktraceFrame{frame}, frames...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &Stacktrace{Frames: frames}
|
|
||||||
} else {
|
|
||||||
return NewStacktrace(skip+1, context, appPackagePrefixes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Intialize and populate a new stacktrace, skipping skip frames.
|
|
||||||
//
|
|
||||||
// context is the number of surrounding lines that should be included for context.
|
|
||||||
// Setting context to 3 would try to get seven lines. Setting context to -1 returns
|
|
||||||
// one line with no surrounding context, and 0 returns no context.
|
|
||||||
//
|
|
||||||
// appPackagePrefixes is a list of prefixes used to check whether a package should
|
|
||||||
// be considered "in app".
|
|
||||||
func NewStacktrace(skip int, context int, appPackagePrefixes []string) *Stacktrace {
|
|
||||||
var frames []*StacktraceFrame
|
|
||||||
|
|
||||||
callerPcs := make([]uintptr, 100)
|
|
||||||
numCallers := runtime.Callers(skip+2, callerPcs)
|
|
||||||
|
|
||||||
// If there are no callers, the entire stacktrace is nil
|
|
||||||
if numCallers == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
callersFrames := runtime.CallersFrames(callerPcs)
|
|
||||||
|
|
||||||
for {
|
|
||||||
fr, more := callersFrames.Next()
|
|
||||||
if fr.Func != nil {
|
|
||||||
frame := NewStacktraceFrame(fr.PC, fr.Function, fr.File, fr.Line, context, appPackagePrefixes)
|
|
||||||
if frame != nil {
|
|
||||||
frames = append(frames, frame)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !more {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If there are no frames, the entire stacktrace is nil
|
|
||||||
if len(frames) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
// Optimize the path where there's only 1 frame
|
|
||||||
if len(frames) == 1 {
|
|
||||||
return &Stacktrace{frames}
|
|
||||||
}
|
|
||||||
// Sentry wants the frames with the oldest first, so reverse them
|
|
||||||
for i, j := 0, len(frames)-1; i < j; i, j = i+1, j-1 {
|
|
||||||
frames[i], frames[j] = frames[j], frames[i]
|
|
||||||
}
|
|
||||||
return &Stacktrace{frames}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build a single frame using data returned from runtime.Caller.
|
|
||||||
//
|
|
||||||
// context is the number of surrounding lines that should be included for context.
|
|
||||||
// Setting context to 3 would try to get seven lines. Setting context to -1 returns
|
|
||||||
// one line with no surrounding context, and 0 returns no context.
|
|
||||||
//
|
|
||||||
// appPackagePrefixes is a list of prefixes used to check whether a package should
|
|
||||||
// be considered "in app".
|
|
||||||
func NewStacktraceFrame(pc uintptr, fName, file string, line, context int, appPackagePrefixes []string) *StacktraceFrame {
|
|
||||||
frame := &StacktraceFrame{AbsolutePath: file, Filename: trimPath(file), Lineno: line, InApp: false}
|
|
||||||
frame.Module, frame.Function = functionName(fName)
|
|
||||||
|
|
||||||
// `runtime.goexit` is effectively a placeholder that comes from
|
|
||||||
// runtime/asm_amd64.s and is meaningless.
|
|
||||||
if frame.Module == "runtime" && frame.Function == "goexit" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if frame.Module == "main" {
|
|
||||||
frame.InApp = true
|
|
||||||
} else {
|
|
||||||
for _, prefix := range appPackagePrefixes {
|
|
||||||
if strings.HasPrefix(frame.Module, prefix) && !strings.Contains(frame.Module, "vendor") && !strings.Contains(frame.Module, "third_party") {
|
|
||||||
frame.InApp = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if context > 0 {
|
|
||||||
contextLines, lineIdx := sourceCodeLoader.Load(file, line, context)
|
|
||||||
if len(contextLines) > 0 {
|
|
||||||
for i, line := range contextLines {
|
|
||||||
switch {
|
|
||||||
case i < lineIdx:
|
|
||||||
frame.PreContext = append(frame.PreContext, string(line))
|
|
||||||
case i == lineIdx:
|
|
||||||
frame.ContextLine = string(line)
|
|
||||||
default:
|
|
||||||
frame.PostContext = append(frame.PostContext, string(line))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if context == -1 {
|
|
||||||
contextLine, _ := sourceCodeLoader.Load(file, line, 0)
|
|
||||||
if len(contextLine) > 0 {
|
|
||||||
frame.ContextLine = string(contextLine[0])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return frame
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve the name of the package and function containing the PC.
|
|
||||||
func functionName(fName string) (pack string, name string) {
|
|
||||||
name = fName
|
|
||||||
// We get this:
|
|
||||||
// runtime/debug.*T·ptrmethod
|
|
||||||
// and want this:
|
|
||||||
// pack = runtime/debug
|
|
||||||
// name = *T.ptrmethod
|
|
||||||
if idx := strings.LastIndex(name, "."); idx != -1 {
|
|
||||||
pack = name[:idx]
|
|
||||||
name = name[idx+1:]
|
|
||||||
}
|
|
||||||
name = strings.Replace(name, "·", ".", -1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type SourceCodeLoader interface {
|
|
||||||
Load(filename string, line, context int) ([][]byte, int)
|
|
||||||
}
|
|
||||||
|
|
||||||
var sourceCodeLoader SourceCodeLoader = &fsLoader{cache: make(map[string][][]byte)}
|
|
||||||
|
|
||||||
func SetSourceCodeLoader(loader SourceCodeLoader) {
|
|
||||||
sourceCodeLoader = loader
|
|
||||||
}
|
|
||||||
|
|
||||||
type fsLoader struct {
|
|
||||||
mu sync.Mutex
|
|
||||||
cache map[string][][]byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fs *fsLoader) Load(filename string, line, context int) ([][]byte, int) {
|
|
||||||
fs.mu.Lock()
|
|
||||||
defer fs.mu.Unlock()
|
|
||||||
lines, ok := fs.cache[filename]
|
|
||||||
if !ok {
|
|
||||||
data, err := ioutil.ReadFile(filename)
|
|
||||||
if err != nil {
|
|
||||||
// cache errors as nil slice: code below handles it correctly
|
|
||||||
// otherwise when missing the source or running as a different user, we try
|
|
||||||
// reading the file on each error which is unnecessary
|
|
||||||
fs.cache[filename] = nil
|
|
||||||
return nil, 0
|
|
||||||
}
|
|
||||||
lines = bytes.Split(data, []byte{'\n'})
|
|
||||||
fs.cache[filename] = lines
|
|
||||||
}
|
|
||||||
|
|
||||||
if lines == nil {
|
|
||||||
// cached error from ReadFile: return no lines
|
|
||||||
return nil, 0
|
|
||||||
}
|
|
||||||
|
|
||||||
line-- // stack trace lines are 1-indexed
|
|
||||||
start := line - context
|
|
||||||
var idx int
|
|
||||||
if start < 0 {
|
|
||||||
start = 0
|
|
||||||
idx = line
|
|
||||||
} else {
|
|
||||||
idx = context
|
|
||||||
}
|
|
||||||
end := line + context + 1
|
|
||||||
if line >= len(lines) {
|
|
||||||
return nil, 0
|
|
||||||
}
|
|
||||||
if end > len(lines) {
|
|
||||||
end = len(lines)
|
|
||||||
}
|
|
||||||
return lines[start:end], idx
|
|
||||||
}
|
|
||||||
|
|
||||||
var trimPaths []string
|
|
||||||
|
|
||||||
// Try to trim the GOROOT or GOPATH prefix off of a filename
|
|
||||||
func trimPath(filename string) string {
|
|
||||||
for _, prefix := range trimPaths {
|
|
||||||
if trimmed := strings.TrimPrefix(filename, prefix); len(trimmed) < len(filename) {
|
|
||||||
return trimmed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filename
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
// Collect all source directories, and make sure they
|
|
||||||
// end in a trailing "separator"
|
|
||||||
for _, prefix := range build.Default.SrcDirs() {
|
|
||||||
if prefix[len(prefix)-1] != filepath.Separator {
|
|
||||||
prefix += string(filepath.Separator)
|
|
||||||
}
|
|
||||||
trimPaths = append(trimPaths, prefix)
|
|
||||||
}
|
|
||||||
}
|
|
20
vendor/github.com/getsentry/raven-go/writer.go
generated
vendored
20
vendor/github.com/getsentry/raven-go/writer.go
generated
vendored
|
@ -1,20 +0,0 @@
|
||||||
package raven
|
|
||||||
|
|
||||||
type Writer struct {
|
|
||||||
Client *Client
|
|
||||||
Level Severity
|
|
||||||
Logger string // Logger name reported to Sentry
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write formats the byte slice p into a string, and sends a message to
|
|
||||||
// Sentry at the severity level indicated by the Writer w.
|
|
||||||
func (w *Writer) Write(p []byte) (int, error) {
|
|
||||||
message := string(p)
|
|
||||||
|
|
||||||
packet := NewPacket(message, &Message{message, nil})
|
|
||||||
packet.Level = w.Level
|
|
||||||
packet.Logger = w.Logger
|
|
||||||
w.Client.Capture(packet, nil)
|
|
||||||
|
|
||||||
return len(p), nil
|
|
||||||
}
|
|
19
vendor/github.com/getsentry/sentry-go/.craft.yml
generated
vendored
Normal file
19
vendor/github.com/getsentry/sentry-go/.craft.yml
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
minVersion: '0.9.2'
|
||||||
|
github:
|
||||||
|
owner: getsentry
|
||||||
|
repo: sentry-go
|
||||||
|
preReleaseCommand: bash scripts/craft-pre-release.sh
|
||||||
|
changelogPolicy: simple
|
||||||
|
statusProvider:
|
||||||
|
name: github
|
||||||
|
config:
|
||||||
|
contexts:
|
||||||
|
- Travis CI - Branch
|
||||||
|
targets:
|
||||||
|
- name: github
|
||||||
|
includeNames: /none/
|
||||||
|
tagPrefix: v
|
||||||
|
- name: registry
|
||||||
|
type: sdk
|
||||||
|
config:
|
||||||
|
canonical: "github:getsentry/sentry-go"
|
6
vendor/github.com/getsentry/sentry-go/.gitignore
generated
vendored
Normal file
6
vendor/github.com/getsentry/sentry-go/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
coverage.txt
|
||||||
|
|
||||||
|
# Just my personal way of tracking stuff — Kamil
|
||||||
|
FIXME.md
|
||||||
|
TODO.md
|
||||||
|
!NOTES.md
|
50
vendor/github.com/getsentry/sentry-go/.golangci.yml
generated
vendored
Normal file
50
vendor/github.com/getsentry/sentry-go/.golangci.yml
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- bodyclose
|
||||||
|
- deadcode
|
||||||
|
- depguard
|
||||||
|
- dogsled
|
||||||
|
- dupl
|
||||||
|
- errcheck
|
||||||
|
- gochecknoglobals
|
||||||
|
- gochecknoinits
|
||||||
|
- goconst
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
- golint
|
||||||
|
- gosec
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- interfacer
|
||||||
|
- lll
|
||||||
|
- maligned
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- prealloc
|
||||||
|
- scopelint
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- typecheck
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
run:
|
||||||
|
skip-dirs:
|
||||||
|
- echo
|
||||||
|
- example/echo
|
||||||
|
issues:
|
||||||
|
exclude:
|
||||||
|
- "not declared by package utf8"
|
||||||
|
- "unicode/utf8/utf8.go"
|
||||||
|
exclude-rules:
|
||||||
|
- path: _test\.go
|
||||||
|
linters:
|
||||||
|
- prealloc
|
||||||
|
- path: errors_test\.go
|
||||||
|
linters:
|
||||||
|
- unused
|
49
vendor/github.com/getsentry/sentry-go/.travis.yml
generated
vendored
Normal file
49
vendor/github.com/getsentry/sentry-go/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
language: go
|
||||||
|
|
||||||
|
go:
|
||||||
|
- 1.12.x
|
||||||
|
- 1.13.x
|
||||||
|
- 1.14.x
|
||||||
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
- GO111MODULE=on GOFLAGS=-mod=readonly
|
||||||
|
- GO111MODULE=off
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
include:
|
||||||
|
- name: "Module support outside of GOPATH"
|
||||||
|
go: stable
|
||||||
|
before_script: >-
|
||||||
|
mv $GOPATH/src/github.com/getsentry/sentry-go ~/sentry-go &&
|
||||||
|
cd ~/sentry-go &&
|
||||||
|
export GOPATH= &&
|
||||||
|
go env GOPATH
|
||||||
|
script: >-
|
||||||
|
go test ./... &&
|
||||||
|
go test ./... -race
|
||||||
|
allow_failures:
|
||||||
|
- go: master
|
||||||
|
fast_finish: true
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.19.1/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.19.1
|
||||||
|
# Fetch origin/master. This is required for `git merge-base` when testing a
|
||||||
|
# branch, since Travis clones only the target branch.
|
||||||
|
- git fetch origin master:remotes/origin/master
|
||||||
|
|
||||||
|
script:
|
||||||
|
- golangci-lint run --new-from-rev=$(git merge-base origin/master HEAD)
|
||||||
|
- go build ./...
|
||||||
|
- go test ./...
|
||||||
|
- go test ./... -race
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
webhooks:
|
||||||
|
urls:
|
||||||
|
- https://zeus.ci/hooks/befe9810-9285-11e9-b01a-0a580a281808/public/provider/travis/webhook
|
||||||
|
on_success: always
|
||||||
|
on_failure: always
|
||||||
|
on_start: always
|
||||||
|
on_cancel: always
|
||||||
|
on_error: always
|
226
vendor/github.com/getsentry/sentry-go/CHANGELOG.md
generated
vendored
Normal file
226
vendor/github.com/getsentry/sentry-go/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,226 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- "I am running away from my responsibilities. And it feels good." – Michael Scott, Season 4, "Money"
|
||||||
|
|
||||||
|
## v0.6.1
|
||||||
|
|
||||||
|
- fix: Use NewEvent to init Event struct (#220)
|
||||||
|
|
||||||
|
_NOTE:_
|
||||||
|
A change introduced in v0.6.0 with the intent of avoiding allocations made a
|
||||||
|
pattern used in official examples break in certain circumstances (attempting
|
||||||
|
to write to a nil map).
|
||||||
|
This release reverts the change such that maps in the Event struct are always
|
||||||
|
allocated.
|
||||||
|
|
||||||
|
## v0.6.0
|
||||||
|
|
||||||
|
- feat: Read module dependencies from runtime/debug (#199)
|
||||||
|
- feat: Support chained errors using Unwrap (#206)
|
||||||
|
- feat: Report chain of errors when available (#185)
|
||||||
|
- **[breaking]** fix: Accept http.RoundTripper to customize transport (#205)
|
||||||
|
Before the SDK accepted a concrete value of type `*http.Transport` in
|
||||||
|
`ClientOptions`, now it accepts any value implementing the `http.RoundTripper`
|
||||||
|
interface. Note that `*http.Transport` implements `http.RoundTripper`, so most
|
||||||
|
code bases will continue to work unchanged.
|
||||||
|
Users of custom transport gain the ability to pass in other implementations of
|
||||||
|
`http.RoundTripper` and may be able to simplify their code bases.
|
||||||
|
- fix: Do not panic when scope event processor drops event (#192)
|
||||||
|
- **[breaking]** fix: Use time.Time for timestamps (#191)
|
||||||
|
Users of sentry-go typically do not need to manipulate timestamps manually.
|
||||||
|
For those who do, the field type changed from `int64` to `time.Time`, which
|
||||||
|
should be more convenient to use. The recommended way to get the current time
|
||||||
|
is `time.Now().UTC()`.
|
||||||
|
- fix: Report usage error including stack trace (#189)
|
||||||
|
- feat: Add Exception.ThreadID field (#183)
|
||||||
|
- ci: Test against Go 1.14, drop 1.11 (#170)
|
||||||
|
- feat: Limit reading bytes from request bodies (#168)
|
||||||
|
- **[breaking]** fix: Rename fasthttp integration package sentryhttp => sentryfasthttp
|
||||||
|
The current recommendation is to use a named import, in which case existing
|
||||||
|
code should not require any change:
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/getsentry/sentry-go"
|
||||||
|
sentryfasthttp "github.com/getsentry/sentry-go/fasthttp"
|
||||||
|
"github.com/valyala/fasthttp"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
_NOTE:_
|
||||||
|
This version includes some new features and a few breaking changes, none of
|
||||||
|
which should pose troubles with upgrading. Most code bases should be able to
|
||||||
|
upgrade without any changes.
|
||||||
|
|
||||||
|
## v0.5.1
|
||||||
|
|
||||||
|
- fix: Ignore err.Cause() when it is nil (#160)
|
||||||
|
|
||||||
|
## v0.5.0
|
||||||
|
|
||||||
|
- fix: Synchronize access to HTTPTransport.disabledUntil (#158)
|
||||||
|
- docs: Update Flush documentation (#153)
|
||||||
|
- fix: HTTPTransport.Flush panic and data race (#140)
|
||||||
|
|
||||||
|
_NOTE:_
|
||||||
|
This version changes the implementation of the default transport, modifying the
|
||||||
|
behavior of `sentry.Flush`. The previous behavior was to wait until there were
|
||||||
|
no buffered events; new concurrent events kept `Flush` from returning. The new
|
||||||
|
behavior is to wait until the last event prior to the call to `Flush` has been
|
||||||
|
sent or the timeout; new concurrent events have no effect. The new behavior is
|
||||||
|
inline with the [Unified API
|
||||||
|
Guidelines](https://docs.sentry.io/development/sdk-dev/unified-api/).
|
||||||
|
|
||||||
|
We have updated the documentation and examples to clarify that `Flush` is meant
|
||||||
|
to be called typically only once before program termination, to wait for
|
||||||
|
in-flight events to be sent to Sentry. Calling `Flush` after every event is not
|
||||||
|
recommended, as it introduces unnecessary latency to the surrounding function.
|
||||||
|
Please verify the usage of `sentry.Flush` in your code base.
|
||||||
|
|
||||||
|
## v0.4.0
|
||||||
|
|
||||||
|
- fix(stacktrace): Correctly report package names (#127)
|
||||||
|
- fix(stacktrace): Do not rely on AbsPath of files (#123)
|
||||||
|
- build: Require github.com/ugorji/go@v1.1.7 (#110)
|
||||||
|
- fix: Correctly store last event id (#99)
|
||||||
|
- fix: Include request body in event payload (#94)
|
||||||
|
- build: Reset go.mod version to 1.11 (#109)
|
||||||
|
- fix: Eliminate data race in modules integration (#105)
|
||||||
|
- feat: Add support for path prefixes in the DSN (#102)
|
||||||
|
- feat: Add HTTPClient option (#86)
|
||||||
|
- feat: Extract correct type and value from top-most error (#85)
|
||||||
|
- feat: Check for broken pipe errors in Gin integration (#82)
|
||||||
|
- fix: Client.CaptureMessage accept nil EventModifier (#72)
|
||||||
|
|
||||||
|
## v0.3.1
|
||||||
|
|
||||||
|
- feat: Send extra information exposed by the Go runtime (#76)
|
||||||
|
- fix: Handle new lines in module integration (#65)
|
||||||
|
- fix: Make sure that cache is locked when updating for contextifyFramesIntegration
|
||||||
|
- ref: Update Iris integration and example to version 12
|
||||||
|
- misc: Remove indirect dependencies in order to move them to separate go.mod files
|
||||||
|
|
||||||
|
## v0.3.0
|
||||||
|
|
||||||
|
- feat: Retry event marshalling without contextual data if the first pass fails
|
||||||
|
- fix: Include `url.Parse` error in `DsnParseError`
|
||||||
|
- fix: Make more `Scope` methods safe for concurrency
|
||||||
|
- fix: Synchronize concurrent access to `Hub.client`
|
||||||
|
- ref: Remove mutex from `Scope` exported API
|
||||||
|
- ref: Remove mutex from `Hub` exported API
|
||||||
|
- ref: Compile regexps for `filterFrames` only once
|
||||||
|
- ref: Change `SampleRate` type to `float64`
|
||||||
|
- doc: `Scope.Clear` not safe for concurrent use
|
||||||
|
- ci: Test sentry-go with `go1.13`, drop `go1.10`
|
||||||
|
|
||||||
|
_NOTE:_
|
||||||
|
This version removes some of the internal APIs that landed publicly (namely `Hub/Scope` mutex structs) and may require (but shouldn't) some changes to your code.
|
||||||
|
It's not done through major version update, as we are still in `0.x` stage.
|
||||||
|
|
||||||
|
## v0.2.1
|
||||||
|
|
||||||
|
- fix: Run `Contextify` integration on `Threads` as well
|
||||||
|
|
||||||
|
## v0.2.0
|
||||||
|
|
||||||
|
- feat: Add `SetTransaction()` method on the `Scope`
|
||||||
|
- feat: `fasthttp` framework support with `sentryfasthttp` package
|
||||||
|
- fix: Add `RWMutex` locks to internal `Hub` and `Scope` changes
|
||||||
|
|
||||||
|
## v0.1.3
|
||||||
|
|
||||||
|
- feat: Move frames context reading into `contextifyFramesIntegration` (#28)
|
||||||
|
|
||||||
|
_NOTE:_
|
||||||
|
In case of any performance issues due to source contexts IO, you can let us know and turn off the integration in the meantime with:
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.Init(sentry.ClientOptions{
|
||||||
|
Integrations: func(integrations []sentry.Integration) []sentry.Integration {
|
||||||
|
var filteredIntegrations []sentry.Integration
|
||||||
|
for _, integration := range integrations {
|
||||||
|
if integration.Name() == "ContextifyFrames" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
filteredIntegrations = append(filteredIntegrations, integration)
|
||||||
|
}
|
||||||
|
return filteredIntegrations
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## v0.1.2
|
||||||
|
|
||||||
|
- feat: Better source code location resolution and more useful inapp frames (#26)
|
||||||
|
- feat: Use `noopTransport` when no `Dsn` provided (#27)
|
||||||
|
- ref: Allow empty `Dsn` instead of returning an error (#22)
|
||||||
|
- fix: Use `NewScope` instead of literal struct inside a `scope.Clear` call (#24)
|
||||||
|
- fix: Add to `WaitGroup` before the request is put inside a buffer (#25)
|
||||||
|
|
||||||
|
## v0.1.1
|
||||||
|
|
||||||
|
- fix: Check for initialized `Client` in `AddBreadcrumbs` (#20)
|
||||||
|
- build: Bump version when releasing with Craft (#19)
|
||||||
|
|
||||||
|
## v0.1.0
|
||||||
|
|
||||||
|
- First stable release! \o/
|
||||||
|
|
||||||
|
## v0.0.1-beta.5
|
||||||
|
|
||||||
|
- feat: **[breaking]** Add `NewHTTPTransport` and `NewHTTPSyncTransport` which accepts all transport options
|
||||||
|
- feat: New `HTTPSyncTransport` that blocks after each call
|
||||||
|
- feat: New `Echo` integration
|
||||||
|
- ref: **[breaking]** Remove `BufferSize` option from `ClientOptions` and move it to `HTTPTransport` instead
|
||||||
|
- ref: Export default `HTTPTransport`
|
||||||
|
- ref: Export `net/http` integration handler
|
||||||
|
- ref: Set `Request` instantly in the package handlers, not in `recoverWithSentry` so it can be accessed later on
|
||||||
|
- ci: Add craft config
|
||||||
|
|
||||||
|
## v0.0.1-beta.4
|
||||||
|
|
||||||
|
- feat: `IgnoreErrors` client option and corresponding integration
|
||||||
|
- ref: Reworked `net/http` integration, wrote better example and complete readme
|
||||||
|
- ref: Reworked `Gin` integration, wrote better example and complete readme
|
||||||
|
- ref: Reworked `Iris` integration, wrote better example and complete readme
|
||||||
|
- ref: Reworked `Negroni` integration, wrote better example and complete readme
|
||||||
|
- ref: Reworked `Martini` integration, wrote better example and complete readme
|
||||||
|
- ref: Remove `Handle()` from frameworks handlers and return it directly from New
|
||||||
|
|
||||||
|
## v0.0.1-beta.3
|
||||||
|
|
||||||
|
- feat: `Iris` framework support with `sentryiris` package
|
||||||
|
- feat: `Gin` framework support with `sentrygin` package
|
||||||
|
- feat: `Martini` framework support with `sentrymartini` package
|
||||||
|
- feat: `Negroni` framework support with `sentrynegroni` package
|
||||||
|
- feat: Add `Hub.Clone()` for easier frameworks integration
|
||||||
|
- feat: Return `EventID` from `Recovery` methods
|
||||||
|
- feat: Add `NewScope` and `NewEvent` functions and use them in the whole codebase
|
||||||
|
- feat: Add `AddEventProcessor` to the `Client`
|
||||||
|
- fix: Operate on requests body copy instead of the original
|
||||||
|
- ref: Try to read source files from the root directory, based on the filename as well, to make it work on AWS Lambda
|
||||||
|
- ref: Remove `gocertifi` dependence and document how to provide your own certificates
|
||||||
|
- ref: **[breaking]** Remove `Decorate` and `DecorateFunc` methods in favor of `sentryhttp` package
|
||||||
|
- ref: **[breaking]** Allow for integrations to live on the client, by passing client instance in `SetupOnce` method
|
||||||
|
- ref: **[breaking]** Remove `GetIntegration` from the `Hub`
|
||||||
|
- ref: **[breaking]** Remove `GlobalEventProcessors` getter from the public API
|
||||||
|
|
||||||
|
## v0.0.1-beta.2
|
||||||
|
|
||||||
|
- feat: Add `AttachStacktrace` client option to include stacktrace for messages
|
||||||
|
- feat: Add `BufferSize` client option to configure transport buffer size
|
||||||
|
- feat: Add `SetRequest` method on a `Scope` to control `Request` context data
|
||||||
|
- feat: Add `FromHTTPRequest` for `Request` type for easier extraction
|
||||||
|
- ref: Extract `Request` information more accurately
|
||||||
|
- fix: Attach `ServerName`, `Release`, `Dist`, `Environment` options to the event
|
||||||
|
- fix: Don't log events dropped due to full transport buffer as sent
|
||||||
|
- fix: Don't panic and create an appropriate event when called `CaptureException` or `Recover` with `nil` value
|
||||||
|
|
||||||
|
## v0.0.1-beta
|
||||||
|
|
||||||
|
- Initial release
|
53
vendor/github.com/getsentry/sentry-go/CONTRIBUTING.md
generated
vendored
Normal file
53
vendor/github.com/getsentry/sentry-go/CONTRIBUTING.md
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
## Community
|
||||||
|
|
||||||
|
The public-facing channels for support and development of Sentry SDKs can be found on [Discord](https://discord.gg/Ww9hbqr).
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ go test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Watch mode
|
||||||
|
|
||||||
|
Use: https://github.com/cespare/reflex
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ reflex -g '*.go' -d "none" -- sh -c 'printf "\n"; go test'
|
||||||
|
```
|
||||||
|
|
||||||
|
### With data race detection
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ go test -race
|
||||||
|
```
|
||||||
|
|
||||||
|
### Coverage
|
||||||
|
```console
|
||||||
|
$ go test -race -coverprofile=coverage.txt -covermode=atomic && go tool cover -html coverage.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Linting
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ golangci-lint run
|
||||||
|
```
|
||||||
|
|
||||||
|
## Release
|
||||||
|
|
||||||
|
1. Update `CHANGELOG.md` with new version in `vX.X.X` format title and list of changes.
|
||||||
|
|
||||||
|
The command below can be used to get a list of changes since the last tag, with the format used in `CHANGELOG.md`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ git log --no-merges --format=%s $(git describe --abbrev=0).. | sed 's/^/- /'
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Commit with `misc: vX.X.X changelog` commit message and push to `master`.
|
||||||
|
|
||||||
|
3. Let [`craft`](https://github.com/getsentry/craft) do the rest:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ craft prepare X.X.X
|
||||||
|
$ craft publish X.X.X
|
||||||
|
```
|
9
vendor/github.com/getsentry/sentry-go/LICENSE
generated
vendored
Normal file
9
vendor/github.com/getsentry/sentry-go/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Copyright (c) 2019 Sentry (https://sentry.io) and individual contributors.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
392
vendor/github.com/getsentry/sentry-go/MIGRATION.md
generated
vendored
Normal file
392
vendor/github.com/getsentry/sentry-go/MIGRATION.md
generated
vendored
Normal file
|
@ -0,0 +1,392 @@
|
||||||
|
# `raven-go` to `sentry-go` Migration Guide
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
go get github.com/getsentry/raven-go
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
go get github.com/getsentry/sentry-go@v0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
import "github.com/getsentry/raven-go"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raven.SetDSN("___PUBLIC_DSN___")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/getsentry/sentry-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
err := sentry.Init(sentry.ClientOptions{
|
||||||
|
Dsn: "___PUBLIC_DSN___",
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Sentry initialization failed: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
SetDSN()
|
||||||
|
SetDefaultLoggerName()
|
||||||
|
SetDebug()
|
||||||
|
SetEnvironment()
|
||||||
|
SetRelease()
|
||||||
|
SetSampleRate()
|
||||||
|
SetIgnoreErrors()
|
||||||
|
SetIncludePaths()
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.Init(sentry.ClientOptions{
|
||||||
|
Dsn: "___PUBLIC_DSN___",
|
||||||
|
DebugWriter: os.Stderr,
|
||||||
|
Debug: true,
|
||||||
|
Environment: "environment",
|
||||||
|
Release: "release",
|
||||||
|
SampleRate: 0.5,
|
||||||
|
// IgnoreErrors: TBD,
|
||||||
|
// IncludePaths: TBD
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Available options: see [Configuration](https://docs.sentry.io/platforms/go/config/) section.
|
||||||
|
|
||||||
|
### Providing SSL Certificates
|
||||||
|
|
||||||
|
By default, TLS uses the host's root CA set. If you don't have `ca-certificates` (which should be your go-to way of fixing the issue of missing certificates) and want to use `gocertifi` instead, you can provide pre-loaded cert files as one of the options to the `sentry.Init` call:
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/certifi/gocertifi"
|
||||||
|
"github.com/getsentry/sentry-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
sentryClientOptions := sentry.ClientOptions{
|
||||||
|
Dsn: "___PUBLIC_DSN___",
|
||||||
|
}
|
||||||
|
|
||||||
|
rootCAs, err := gocertifi.CACerts()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Couldn't load CA Certificates: %v\n", err)
|
||||||
|
} else {
|
||||||
|
sentryClientOptions.CaCerts = rootCAs
|
||||||
|
}
|
||||||
|
|
||||||
|
sentry.Init(sentryClientOptions)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Capturing Errors
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
f, err := os.Open("filename.ext")
|
||||||
|
if err != nil {
|
||||||
|
raven.CaptureError(err, nil)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
f, err := os.Open("filename.ext")
|
||||||
|
if err != nil {
|
||||||
|
sentry.CaptureException(err)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Capturing Panics
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.CapturePanic(func() {
|
||||||
|
// do all of the scary things here
|
||||||
|
}, nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
func() {
|
||||||
|
defer sentry.Recover()
|
||||||
|
// do all of the scary things here
|
||||||
|
}()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Capturing Messages
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.CaptureMessage("Something bad happened and I would like to know about that")
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.CaptureMessage("Something bad happened and I would like to know about that")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Capturing Events
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
packet := &raven.Packet{
|
||||||
|
Message: "Hand-crafted event",
|
||||||
|
Extra: &raven.Extra{
|
||||||
|
"runtime.Version": runtime.Version(),
|
||||||
|
"runtime.NumCPU": runtime.NumCPU(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
raven.Capture(packet)
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
event := &sentry.NewEvent()
|
||||||
|
event.Message = "Hand-crafted event"
|
||||||
|
event.Extra["runtime.Version"] = runtime.Version()
|
||||||
|
event.Extra["runtime.NumCPU"] = runtime.NumCPU()
|
||||||
|
|
||||||
|
sentry.CaptureEvent(event)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Additional Data
|
||||||
|
|
||||||
|
See Context section.
|
||||||
|
|
||||||
|
### Event Sampling
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.SetSampleRate(0.25)
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.Init(sentry.ClientOptions{
|
||||||
|
SampleRate: 0.25,
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Awaiting the response (not recommended)
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.CaptureMessageAndWait("Something bad happened and I would like to know about that")
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.CaptureMessage("Something bad happened and I would like to know about that")
|
||||||
|
|
||||||
|
if sentry.Flush(time.Second * 2) {
|
||||||
|
// event delivered
|
||||||
|
} else {
|
||||||
|
// timeout reached
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
### Per-event
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.CaptureError(err, map[string]string{"browser": "Firefox"}, &raven.Http{
|
||||||
|
Method: "GET",
|
||||||
|
URL: "https://example.com/raven-go"
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.WithScope(func(scope *sentry.Scope) {
|
||||||
|
scope.SetTag("browser", "Firefox")
|
||||||
|
scope.SetContext("Request", map[string]string{
|
||||||
|
"Method": "GET",
|
||||||
|
"URL": "https://example.com/raven-go",
|
||||||
|
})
|
||||||
|
sentry.CaptureException(err)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Globally
|
||||||
|
|
||||||
|
#### SetHttpContext
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.SetHttpContext(&raven.Http{
|
||||||
|
Method: "GET",
|
||||||
|
URL: "https://example.com/raven-go",
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.ConfigureScope(func(scope *sentry.Scope) {
|
||||||
|
scope.SetContext("Request", map[string]string{
|
||||||
|
"Method": "GET",
|
||||||
|
"URL": "https://example.com/raven-go",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### SetTagsContext
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
t := map[string]string{"day": "Friday", "sport": "Weightlifting"}
|
||||||
|
raven.SetTagsContext(map[string]string{"day": "Friday", "sport": "Weightlifting"})
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.ConfigureScope(func(scope *sentry.Scope) {
|
||||||
|
scope.SetTags(map[string]string{"day": "Friday", "sport": "Weightlifting"})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### SetUserContext
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.SetUserContext(&raven.User{
|
||||||
|
ID: "1337",
|
||||||
|
Username: "kamilogorek",
|
||||||
|
Email: "kamil@sentry.io",
|
||||||
|
IP: "127.0.0.1",
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.ConfigureScope(func(scope *sentry.Scope) {
|
||||||
|
scope.SetUser(sentry.User{
|
||||||
|
ID: "1337",
|
||||||
|
Username: "kamilogorek",
|
||||||
|
Email: "kamil@sentry.io",
|
||||||
|
IPAddress: "127.0.0.1",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ClearContext
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
raven.ClearContext()
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentry.ConfigureScope(func(scope *sentry.Scope) {
|
||||||
|
scope.Clear()
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### WrapWithExtra
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
path := "filename.ext"
|
||||||
|
f, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
err = raven.WrapWithExtra(err, map[string]string{"path": path, "cwd": os.Getwd()}
|
||||||
|
raven.CaptureError(err, nil)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
// use `sentry.WithScope`, see "Context / Per-event Section"
|
||||||
|
path := "filename.ext"
|
||||||
|
f, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
sentry.WithScope(func(scope *sentry.Scope) {
|
||||||
|
sentry.SetExtras(map[string]interface{}{"path": path, "cwd": os.Getwd())
|
||||||
|
sentry.CaptureException(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integrations
|
||||||
|
|
||||||
|
### net/http
|
||||||
|
|
||||||
|
raven-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
mux := http.NewServeMux
|
||||||
|
http.Handle("/", raven.Recoverer(mux))
|
||||||
|
|
||||||
|
// or
|
||||||
|
|
||||||
|
func root(w http.ResponseWriter, r *http.Request) {}
|
||||||
|
http.HandleFunc("/", raven.RecoveryHandler(root))
|
||||||
|
```
|
||||||
|
|
||||||
|
sentry-go
|
||||||
|
|
||||||
|
```go
|
||||||
|
sentryHandler := sentryhttp.New(sentryhttp.Options{
|
||||||
|
Repanic: false,
|
||||||
|
WaitForDelivery: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
mux := http.NewServeMux
|
||||||
|
http.Handle("/", sentryHandler.Handle(mux))
|
||||||
|
|
||||||
|
// or
|
||||||
|
|
||||||
|
func root(w http.ResponseWriter, r *http.Request) {}
|
||||||
|
http.HandleFunc("/", sentryHandler.HandleFunc(root))
|
||||||
|
```
|
190
vendor/github.com/getsentry/sentry-go/README.md
generated
vendored
Normal file
190
vendor/github.com/getsentry/sentry-go/README.md
generated
vendored
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://sentry.io" target="_blank" align="center">
|
||||||
|
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
|
||||||
|
</a>
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# Official Sentry SDK for Go
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.com/getsentry/sentry-go.svg?branch=master)](https://travis-ci.com/getsentry/sentry-go)
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/github.com/getsentry/sentry-go)](https://goreportcard.com/report/github.com/getsentry/sentry-go)
|
||||||
|
[![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
|
||||||
|
[![GoDoc](https://godoc.org/github.com/getsentry/sentry-go?status.svg)](https://godoc.org/github.com/getsentry/sentry-go)
|
||||||
|
[![go.dev](https://img.shields.io/badge/go.dev-pkg-007d9c.svg?style=flat)](https://pkg.go.dev/github.com/getsentry/sentry-go)
|
||||||
|
|
||||||
|
`sentry-go` provides a Sentry client implementation for the Go programming
|
||||||
|
language. This is the next line of the Go SDK for [Sentry](https://sentry.io/),
|
||||||
|
intended to replace the `raven-go` package.
|
||||||
|
|
||||||
|
> Looking for the old `raven-go` SDK documentation? See the Legacy client section [here](https://docs.sentry.io/clients/go/).
|
||||||
|
> If you want to start using sentry-go instead, check out the [migration guide](https://docs.sentry.io/platforms/go/migration/).
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
The only requirement is a Go compiler.
|
||||||
|
|
||||||
|
We verify this package against the 3 most recent releases of Go. Those are the
|
||||||
|
supported versions. The exact versions are defined in
|
||||||
|
[`.travis.yml`](.travis.yml).
|
||||||
|
|
||||||
|
In addition, we run tests against the current master branch of the Go toolchain,
|
||||||
|
though support for this configuration is best-effort.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
`sentry-go` can be installed like any other Go library through `go get`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ go get github.com/getsentry/sentry-go
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, if you are already using
|
||||||
|
[Go Modules](https://github.com/golang/go/wiki/Modules), you may specify a
|
||||||
|
version number as well:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ go get github.com/getsentry/sentry-go@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Check out the [list of released versions](https://pkg.go.dev/github.com/getsentry/sentry-go?tab=versions).
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
To use `sentry-go`, you’ll need to import the `sentry-go` package and initialize
|
||||||
|
it with your DSN and other [options](https://godoc.org/github.com/getsentry/sentry-go#ClientOptions).
|
||||||
|
|
||||||
|
If not specified in the SDK initialization, the
|
||||||
|
[DSN](https://docs.sentry.io/error-reporting/configuration/?platform=go#dsn),
|
||||||
|
[Release](https://docs.sentry.io/workflow/releases/?platform=go) and
|
||||||
|
[Environment](https://docs.sentry.io/enriching-error-data/environments/?platform=go)
|
||||||
|
are read from the environment variables `SENTRY_DSN`, `SENTRY_RELEASE` and
|
||||||
|
`SENTRY_ENVIRONMENT`, respectively.
|
||||||
|
|
||||||
|
More on this in the [Configuration](https://docs.sentry.io/platforms/go/config/)
|
||||||
|
section of the official Sentry documentation.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The SDK must be initialized with a call to `sentry.Init`. The default transport
|
||||||
|
is asynchronous and thus most programs should call `sentry.Flush` to wait until
|
||||||
|
buffered events are sent to Sentry right before the program terminates.
|
||||||
|
|
||||||
|
Typically, `sentry.Init` is called in the beginning of `func main` and
|
||||||
|
`sentry.Flush` is [deferred](https://golang.org/ref/spec#Defer_statements) right
|
||||||
|
after.
|
||||||
|
|
||||||
|
> Note that if the program terminates with a call to
|
||||||
|
> [`os.Exit`](https://golang.org/pkg/os/#Exit), either directly or indirectly
|
||||||
|
> via another function like `log.Fatal`, deferred functions are not run.
|
||||||
|
>
|
||||||
|
> In that case, and if it is important for you to report outstanding events
|
||||||
|
> before terminating the program, arrange for `sentry.Flush` to be called before
|
||||||
|
> the program terminates.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```go
|
||||||
|
// This is an example program that makes an HTTP request and prints response
|
||||||
|
// headers. Whenever a request fails, the error is reported to Sentry.
|
||||||
|
//
|
||||||
|
// Try it by running:
|
||||||
|
//
|
||||||
|
// go run main.go
|
||||||
|
// go run main.go https://sentry.io
|
||||||
|
// go run main.go bad-url
|
||||||
|
//
|
||||||
|
// To actually report events to Sentry, set the DSN either by editing the
|
||||||
|
// appropriate line below or setting the environment variable SENTRY_DSN to
|
||||||
|
// match the DSN of your Sentry project.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/getsentry/sentry-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if len(os.Args) < 2 {
|
||||||
|
log.Fatalf("usage: %s URL", os.Args[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
err := sentry.Init(sentry.ClientOptions{
|
||||||
|
// Either set your DSN here or set the SENTRY_DSN environment variable.
|
||||||
|
Dsn: "",
|
||||||
|
// Enable printing of SDK debug messages.
|
||||||
|
// Useful when getting started or trying to figure something out.
|
||||||
|
Debug: true,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("sentry.Init: %s", err)
|
||||||
|
}
|
||||||
|
// Flush buffered events before the program terminates.
|
||||||
|
// Set the timeout to the maximum duration the program can afford to wait.
|
||||||
|
defer sentry.Flush(2 * time.Second)
|
||||||
|
|
||||||
|
resp, err := http.Get(os.Args[1])
|
||||||
|
if err != nil {
|
||||||
|
sentry.CaptureException(err)
|
||||||
|
log.Printf("reported to Sentry: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
for header, values := range resp.Header {
|
||||||
|
for _, value := range values {
|
||||||
|
fmt.Printf("%s=%s\n", header, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For your convenience, this example is available at
|
||||||
|
[`example/basic/main.go`](example/basic/main.go).
|
||||||
|
There are also more examples in the
|
||||||
|
[example](example) directory.
|
||||||
|
|
||||||
|
For more detailed information about how to get the most out of `sentry-go`,
|
||||||
|
checkout the official documentation:
|
||||||
|
|
||||||
|
- [Configuration](https://docs.sentry.io/platforms/go/config)
|
||||||
|
- [Error Reporting](https://docs.sentry.io/error-reporting/quickstart?platform=go)
|
||||||
|
- [Enriching Error Data](https://docs.sentry.io/enriching-error-data/context?platform=go)
|
||||||
|
- [Transports](https://docs.sentry.io/platforms/go/transports)
|
||||||
|
- [Integrations](https://docs.sentry.io/platforms/go/integrations)
|
||||||
|
- [net/http](https://docs.sentry.io/platforms/go/http)
|
||||||
|
- [echo](https://docs.sentry.io/platforms/go/echo)
|
||||||
|
- [fasthttp](https://docs.sentry.io/platforms/go/fasthttp)
|
||||||
|
- [gin](https://docs.sentry.io/platforms/go/gin)
|
||||||
|
- [iris](https://docs.sentry.io/platforms/go/iris)
|
||||||
|
- [martini](https://docs.sentry.io/platforms/go/martini)
|
||||||
|
- [negroni](https://docs.sentry.io/platforms/go/negroni)
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [Bug Tracker](https://github.com/getsentry/sentry-go/issues)
|
||||||
|
- [GitHub Project](https://github.com/getsentry/sentry-go)
|
||||||
|
- [![GoDoc](https://godoc.org/github.com/getsentry/sentry-go?status.svg)](https://godoc.org/github.com/getsentry/sentry-go)
|
||||||
|
- [![go.dev](https://img.shields.io/badge/go.dev-pkg-007d9c.svg?style=flat)](https://pkg.go.dev/github.com/getsentry/sentry-go)
|
||||||
|
- [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/go/)
|
||||||
|
- [![Forum](https://img.shields.io/badge/forum-sentry-green.svg)](https://forum.sentry.io/c/sdks)
|
||||||
|
- [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
|
||||||
|
- [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](http://stackoverflow.com/questions/tagged/sentry)
|
||||||
|
- [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Licensed under
|
||||||
|
[The 2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause), see
|
||||||
|
[`LICENSE`](LICENSE).
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
Join Sentry's [`#go` channel on Discord](https://discord.gg/Ww9hbqr) to get
|
||||||
|
involved and help us improve the SDK!
|
487
vendor/github.com/getsentry/sentry-go/client.go
generated
vendored
Normal file
487
vendor/github.com/getsentry/sentry-go/client.go
generated
vendored
Normal file
|
@ -0,0 +1,487 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/x509"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"math/rand"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
"sort"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// maxErrorDepth is the maximum number of errors reported in a chain of errors.
|
||||||
|
// This protects the SDK from an arbitrarily long chain of wrapped errors.
|
||||||
|
//
|
||||||
|
// An additional consideration is that arguably reporting a long chain of errors
|
||||||
|
// is of little use when debugging production errors with Sentry. The Sentry UI
|
||||||
|
// is not optimized for long chains either. The top-level error together with a
|
||||||
|
// stack trace is often the most useful information.
|
||||||
|
const maxErrorDepth = 10
|
||||||
|
|
||||||
|
// usageError is used to report to Sentry an SDK usage error.
|
||||||
|
//
|
||||||
|
// It is not exported because it is never returned by any function or method in
|
||||||
|
// the exported API.
|
||||||
|
type usageError struct {
|
||||||
|
error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logger is an instance of log.Logger that is use to provide debug information about running Sentry Client
|
||||||
|
// can be enabled by either using `Logger.SetOutput` directly or with `Debug` client option
|
||||||
|
var Logger = log.New(ioutil.Discard, "[Sentry] ", log.LstdFlags) //nolint: gochecknoglobals
|
||||||
|
|
||||||
|
type EventProcessor func(event *Event, hint *EventHint) *Event
|
||||||
|
|
||||||
|
type EventModifier interface {
|
||||||
|
ApplyToEvent(event *Event, hint *EventHint) *Event
|
||||||
|
}
|
||||||
|
|
||||||
|
var globalEventProcessors []EventProcessor //nolint: gochecknoglobals
|
||||||
|
|
||||||
|
func AddGlobalEventProcessor(processor EventProcessor) {
|
||||||
|
globalEventProcessors = append(globalEventProcessors, processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Integration allows for registering a functions that modify or discard captured events.
|
||||||
|
type Integration interface {
|
||||||
|
Name() string
|
||||||
|
SetupOnce(client *Client)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOptions that configures a SDK Client
|
||||||
|
type ClientOptions struct {
|
||||||
|
// The DSN to use. If the DSN is not set, the client is effectively disabled.
|
||||||
|
Dsn string
|
||||||
|
// In debug mode, the debug information is printed to stdout to help you understand what
|
||||||
|
// sentry is doing.
|
||||||
|
Debug bool
|
||||||
|
// Configures whether SDK should generate and attach stacktraces to pure capture message calls.
|
||||||
|
AttachStacktrace bool
|
||||||
|
// The sample rate for event submission (0.0 - 1.0, defaults to 1.0).
|
||||||
|
SampleRate float64
|
||||||
|
// List of regexp strings that will be used to match against event's message
|
||||||
|
// and if applicable, caught errors type and value.
|
||||||
|
// If the match is found, then a whole event will be dropped.
|
||||||
|
IgnoreErrors []string
|
||||||
|
// Before send callback.
|
||||||
|
BeforeSend func(event *Event, hint *EventHint) *Event
|
||||||
|
// Before breadcrumb add callback.
|
||||||
|
BeforeBreadcrumb func(breadcrumb *Breadcrumb, hint *BreadcrumbHint) *Breadcrumb
|
||||||
|
// Integrations to be installed on the current Client, receives default integrations
|
||||||
|
Integrations func([]Integration) []Integration
|
||||||
|
// io.Writer implementation that should be used with the `Debug` mode
|
||||||
|
DebugWriter io.Writer
|
||||||
|
// The transport to use.
|
||||||
|
// This is an instance of a struct implementing `Transport` interface.
|
||||||
|
// Defaults to `httpTransport` from `transport.go`
|
||||||
|
Transport Transport
|
||||||
|
// The server name to be reported.
|
||||||
|
ServerName string
|
||||||
|
// The release to be sent with events.
|
||||||
|
Release string
|
||||||
|
// The dist to be sent with events.
|
||||||
|
Dist string
|
||||||
|
// The environment to be sent with events.
|
||||||
|
Environment string
|
||||||
|
// Maximum number of breadcrumbs.
|
||||||
|
MaxBreadcrumbs int
|
||||||
|
// An optional pointer to `http.Client` that will be used with a default HTTPTransport.
|
||||||
|
// Using your own client will make HTTPTransport, HTTPProxy, HTTPSProxy and CaCerts options ignored.
|
||||||
|
HTTPClient *http.Client
|
||||||
|
// An optional pointer to `http.Transport` that will be used with a default HTTPTransport.
|
||||||
|
// Using your own transport will make HTTPProxy, HTTPSProxy and CaCerts options ignored.
|
||||||
|
HTTPTransport http.RoundTripper
|
||||||
|
// An optional HTTP proxy to use.
|
||||||
|
// This will default to the `http_proxy` environment variable.
|
||||||
|
// or `https_proxy` if that one exists.
|
||||||
|
HTTPProxy string
|
||||||
|
// An optional HTTPS proxy to use.
|
||||||
|
// This will default to the `HTTPS_PROXY` environment variable
|
||||||
|
// or `http_proxy` if that one exists.
|
||||||
|
HTTPSProxy string
|
||||||
|
// An optional CaCerts to use.
|
||||||
|
// Defaults to `gocertifi.CACerts()`.
|
||||||
|
CaCerts *x509.CertPool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client is the underlying processor that's used by the main API and `Hub` instances.
|
||||||
|
type Client struct {
|
||||||
|
options ClientOptions
|
||||||
|
dsn *Dsn
|
||||||
|
eventProcessors []EventProcessor
|
||||||
|
integrations []Integration
|
||||||
|
Transport Transport
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewClient creates and returns an instance of `Client` configured using `ClientOptions`.
|
||||||
|
func NewClient(options ClientOptions) (*Client, error) {
|
||||||
|
if options.Debug {
|
||||||
|
debugWriter := options.DebugWriter
|
||||||
|
if debugWriter == nil {
|
||||||
|
debugWriter = os.Stdout
|
||||||
|
}
|
||||||
|
Logger.SetOutput(debugWriter)
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.Dsn == "" {
|
||||||
|
options.Dsn = os.Getenv("SENTRY_DSN")
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.Release == "" {
|
||||||
|
options.Release = os.Getenv("SENTRY_RELEASE")
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.Environment == "" {
|
||||||
|
options.Environment = os.Getenv("SENTRY_ENVIRONMENT")
|
||||||
|
}
|
||||||
|
|
||||||
|
var dsn *Dsn
|
||||||
|
if options.Dsn != "" {
|
||||||
|
var err error
|
||||||
|
dsn, err = NewDsn(options.Dsn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
client := Client{
|
||||||
|
options: options,
|
||||||
|
dsn: dsn,
|
||||||
|
}
|
||||||
|
|
||||||
|
client.setupTransport()
|
||||||
|
client.setupIntegrations()
|
||||||
|
|
||||||
|
return &client, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *Client) setupTransport() {
|
||||||
|
transport := client.options.Transport
|
||||||
|
|
||||||
|
if transport == nil {
|
||||||
|
if client.options.Dsn == "" {
|
||||||
|
transport = new(noopTransport)
|
||||||
|
} else {
|
||||||
|
transport = NewHTTPTransport()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transport.Configure(client.options)
|
||||||
|
client.Transport = transport
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *Client) setupIntegrations() {
|
||||||
|
integrations := []Integration{
|
||||||
|
new(contextifyFramesIntegration),
|
||||||
|
new(environmentIntegration),
|
||||||
|
new(modulesIntegration),
|
||||||
|
new(ignoreErrorsIntegration),
|
||||||
|
}
|
||||||
|
|
||||||
|
if client.options.Integrations != nil {
|
||||||
|
integrations = client.options.Integrations(integrations)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, integration := range integrations {
|
||||||
|
if client.integrationAlreadyInstalled(integration.Name()) {
|
||||||
|
Logger.Printf("Integration %s is already installed\n", integration.Name())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
client.integrations = append(client.integrations, integration)
|
||||||
|
integration.SetupOnce(client)
|
||||||
|
Logger.Printf("Integration installed: %s\n", integration.Name())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddEventProcessor adds an event processor to the client.
|
||||||
|
func (client *Client) AddEventProcessor(processor EventProcessor) {
|
||||||
|
client.eventProcessors = append(client.eventProcessors, processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Options return `ClientOptions` for the current `Client`.
|
||||||
|
func (client Client) Options() ClientOptions {
|
||||||
|
return client.options
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureMessage captures an arbitrary message.
|
||||||
|
func (client *Client) CaptureMessage(message string, hint *EventHint, scope EventModifier) *EventID {
|
||||||
|
event := client.eventFromMessage(message, LevelInfo)
|
||||||
|
return client.CaptureEvent(event, hint, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureException captures an error.
|
||||||
|
func (client *Client) CaptureException(exception error, hint *EventHint, scope EventModifier) *EventID {
|
||||||
|
event := client.eventFromException(exception, LevelError)
|
||||||
|
return client.CaptureEvent(event, hint, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureEvent captures an event on the currently active client if any.
|
||||||
|
//
|
||||||
|
// The event must already be assembled. Typically code would instead use
|
||||||
|
// the utility methods like `CaptureException`. The return value is the
|
||||||
|
// event ID. In case Sentry is disabled or event was dropped, the return value will be nil.
|
||||||
|
func (client *Client) CaptureEvent(event *Event, hint *EventHint, scope EventModifier) *EventID {
|
||||||
|
return client.processEvent(event, hint, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover captures a panic.
|
||||||
|
// Returns `EventID` if successfully, or `nil` if there's no error to recover from.
|
||||||
|
func (client *Client) Recover(err interface{}, hint *EventHint, scope EventModifier) *EventID {
|
||||||
|
if err == nil {
|
||||||
|
err = recover()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
if err, ok := err.(error); ok {
|
||||||
|
event := client.eventFromException(err, LevelFatal)
|
||||||
|
return client.CaptureEvent(event, hint, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err, ok := err.(string); ok {
|
||||||
|
event := client.eventFromMessage(err, LevelFatal)
|
||||||
|
return client.CaptureEvent(event, hint, scope)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover captures a panic and passes relevant context object.
|
||||||
|
// Returns `EventID` if successfully, or `nil` if there's no error to recover from.
|
||||||
|
func (client *Client) RecoverWithContext(
|
||||||
|
ctx context.Context,
|
||||||
|
err interface{},
|
||||||
|
hint *EventHint,
|
||||||
|
scope EventModifier,
|
||||||
|
) *EventID {
|
||||||
|
if err == nil {
|
||||||
|
err = recover()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
if hint.Context == nil && ctx != nil {
|
||||||
|
hint.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
if err, ok := err.(error); ok {
|
||||||
|
event := client.eventFromException(err, LevelFatal)
|
||||||
|
return client.CaptureEvent(event, hint, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err, ok := err.(string); ok {
|
||||||
|
event := client.eventFromMessage(err, LevelFatal)
|
||||||
|
return client.CaptureEvent(event, hint, scope)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush waits until the underlying Transport sends any buffered events to the
|
||||||
|
// Sentry server, blocking for at most the given timeout. It returns false if
|
||||||
|
// the timeout was reached. In that case, some events may not have been sent.
|
||||||
|
//
|
||||||
|
// Flush should be called before terminating the program to avoid
|
||||||
|
// unintentionally dropping events.
|
||||||
|
//
|
||||||
|
// Do not call Flush indiscriminately after every call to CaptureEvent,
|
||||||
|
// CaptureException or CaptureMessage. Instead, to have the SDK send events over
|
||||||
|
// the network synchronously, configure it to use the HTTPSyncTransport in the
|
||||||
|
// call to Init.
|
||||||
|
func (client *Client) Flush(timeout time.Duration) bool {
|
||||||
|
return client.Transport.Flush(timeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *Client) eventFromMessage(message string, level Level) *Event {
|
||||||
|
event := NewEvent()
|
||||||
|
event.Level = level
|
||||||
|
event.Message = message
|
||||||
|
|
||||||
|
if client.Options().AttachStacktrace {
|
||||||
|
event.Threads = []Thread{{
|
||||||
|
Stacktrace: NewStacktrace(),
|
||||||
|
Crashed: false,
|
||||||
|
Current: true,
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return event
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *Client) eventFromException(exception error, level Level) *Event {
|
||||||
|
err := exception
|
||||||
|
if err == nil {
|
||||||
|
err = usageError{fmt.Errorf("%s called with nil error", callerFunctionName())}
|
||||||
|
}
|
||||||
|
|
||||||
|
event := NewEvent()
|
||||||
|
event.Level = level
|
||||||
|
|
||||||
|
for i := 0; i < maxErrorDepth && err != nil; i++ {
|
||||||
|
event.Exception = append(event.Exception, Exception{
|
||||||
|
Value: err.Error(),
|
||||||
|
Type: reflect.TypeOf(err).String(),
|
||||||
|
Stacktrace: ExtractStacktrace(err),
|
||||||
|
})
|
||||||
|
switch previous := err.(type) {
|
||||||
|
case interface{ Unwrap() error }:
|
||||||
|
err = previous.Unwrap()
|
||||||
|
case interface{ Cause() error }:
|
||||||
|
err = previous.Cause()
|
||||||
|
default:
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a trace of the current stack to the most recent error in a chain if
|
||||||
|
// it doesn't have a stack trace yet.
|
||||||
|
// We only add to the most recent error to avoid duplication and because the
|
||||||
|
// current stack is most likely unrelated to errors deeper in the chain.
|
||||||
|
if event.Exception[0].Stacktrace == nil {
|
||||||
|
event.Exception[0].Stacktrace = NewStacktrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
// event.Exception should be sorted such that the most recent error is last.
|
||||||
|
reverse(event.Exception)
|
||||||
|
|
||||||
|
return event
|
||||||
|
}
|
||||||
|
|
||||||
|
// reverse reverses the slice a in place.
|
||||||
|
func reverse(a []Exception) {
|
||||||
|
for i := len(a)/2 - 1; i >= 0; i-- {
|
||||||
|
opp := len(a) - 1 - i
|
||||||
|
a[i], a[opp] = a[opp], a[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *Client) processEvent(event *Event, hint *EventHint, scope EventModifier) *EventID {
|
||||||
|
options := client.Options()
|
||||||
|
|
||||||
|
// TODO: Reconsider if its worth going away from default implementation
|
||||||
|
// of other SDKs. In Go zero value (default) for float32 is 0.0,
|
||||||
|
// which means that if someone uses ClientOptions{} struct directly
|
||||||
|
// and we would not check for 0 here, we'd skip all events by default
|
||||||
|
if options.SampleRate != 0.0 {
|
||||||
|
randomFloat := rand.New(rand.NewSource(time.Now().UnixNano())).Float64()
|
||||||
|
if randomFloat > options.SampleRate {
|
||||||
|
Logger.Println("Event dropped due to SampleRate hit.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if event = client.prepareEvent(event, hint, scope); event == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.BeforeSend != nil {
|
||||||
|
h := &EventHint{}
|
||||||
|
if hint != nil {
|
||||||
|
h = hint
|
||||||
|
}
|
||||||
|
if event = options.BeforeSend(event, h); event == nil {
|
||||||
|
Logger.Println("Event dropped due to BeforeSend callback.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
client.Transport.SendEvent(event)
|
||||||
|
|
||||||
|
return &event.EventID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *Client) prepareEvent(event *Event, hint *EventHint, scope EventModifier) *Event {
|
||||||
|
if event.EventID == "" {
|
||||||
|
event.EventID = EventID(uuid())
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.Timestamp.IsZero() {
|
||||||
|
event.Timestamp = time.Now().UTC()
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.Level == "" {
|
||||||
|
event.Level = LevelInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.ServerName == "" {
|
||||||
|
if client.Options().ServerName != "" {
|
||||||
|
event.ServerName = client.Options().ServerName
|
||||||
|
} else if hostname, err := os.Hostname(); err == nil {
|
||||||
|
event.ServerName = hostname
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.Release == "" && client.Options().Release != "" {
|
||||||
|
event.Release = client.Options().Release
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.Dist == "" && client.Options().Dist != "" {
|
||||||
|
event.Dist = client.Options().Dist
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.Environment == "" && client.Options().Environment != "" {
|
||||||
|
event.Environment = client.Options().Environment
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Platform = "go"
|
||||||
|
event.Sdk = SdkInfo{
|
||||||
|
Name: "sentry.go",
|
||||||
|
Version: Version,
|
||||||
|
Integrations: client.listIntegrations(),
|
||||||
|
Packages: []SdkPackage{{
|
||||||
|
Name: "sentry-go",
|
||||||
|
Version: Version,
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
|
||||||
|
if scope != nil {
|
||||||
|
event = scope.ApplyToEvent(event, hint)
|
||||||
|
if event == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, processor := range client.eventProcessors {
|
||||||
|
id := event.EventID
|
||||||
|
event = processor(event, hint)
|
||||||
|
if event == nil {
|
||||||
|
Logger.Printf("Event dropped by one of the Client EventProcessors: %s\n", id)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, processor := range globalEventProcessors {
|
||||||
|
id := event.EventID
|
||||||
|
event = processor(event, hint)
|
||||||
|
if event == nil {
|
||||||
|
Logger.Printf("Event dropped by one of the Global EventProcessors: %s\n", id)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return event
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client Client) listIntegrations() []string {
|
||||||
|
integrations := make([]string, 0, len(client.integrations))
|
||||||
|
for _, integration := range client.integrations {
|
||||||
|
integrations = append(integrations, integration.Name())
|
||||||
|
}
|
||||||
|
sort.Strings(integrations)
|
||||||
|
return integrations
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client Client) integrationAlreadyInstalled(name string) bool {
|
||||||
|
for _, integration := range client.integrations {
|
||||||
|
if integration.Name() == name {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
188
vendor/github.com/getsentry/sentry-go/dsn.go
generated
vendored
Normal file
188
vendor/github.com/getsentry/sentry-go/dsn.go
generated
vendored
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type scheme string
|
||||||
|
|
||||||
|
const (
|
||||||
|
schemeHTTP scheme = "http"
|
||||||
|
schemeHTTPS scheme = "https"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (scheme scheme) defaultPort() int {
|
||||||
|
switch scheme {
|
||||||
|
case schemeHTTPS:
|
||||||
|
return 443
|
||||||
|
case schemeHTTP:
|
||||||
|
return 80
|
||||||
|
default:
|
||||||
|
return 80
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type DsnParseError struct {
|
||||||
|
Message string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e DsnParseError) Error() string {
|
||||||
|
return "[Sentry] DsnParseError: " + e.Message
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dsn is used as the remote address source to client transport.
|
||||||
|
type Dsn struct {
|
||||||
|
scheme scheme
|
||||||
|
publicKey string
|
||||||
|
secretKey string
|
||||||
|
host string
|
||||||
|
port int
|
||||||
|
path string
|
||||||
|
projectID int
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDsn creates an instance of `Dsn` by parsing provided url in a `string` format.
|
||||||
|
// If Dsn is not set the client is effectively disabled.
|
||||||
|
func NewDsn(rawURL string) (*Dsn, error) {
|
||||||
|
// Parse
|
||||||
|
parsedURL, err := url.Parse(rawURL)
|
||||||
|
if err != nil {
|
||||||
|
return nil, &DsnParseError{fmt.Sprintf("invalid url: %v", err)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scheme
|
||||||
|
var scheme scheme
|
||||||
|
switch parsedURL.Scheme {
|
||||||
|
case "http":
|
||||||
|
scheme = schemeHTTP
|
||||||
|
case "https":
|
||||||
|
scheme = schemeHTTPS
|
||||||
|
default:
|
||||||
|
return nil, &DsnParseError{"invalid scheme"}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublicKey
|
||||||
|
publicKey := parsedURL.User.Username()
|
||||||
|
if publicKey == "" {
|
||||||
|
return nil, &DsnParseError{"empty username"}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SecretKey
|
||||||
|
var secretKey string
|
||||||
|
if parsedSecretKey, ok := parsedURL.User.Password(); ok {
|
||||||
|
secretKey = parsedSecretKey
|
||||||
|
}
|
||||||
|
|
||||||
|
// Host
|
||||||
|
host := parsedURL.Hostname()
|
||||||
|
if host == "" {
|
||||||
|
return nil, &DsnParseError{"empty host"}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Port
|
||||||
|
var port int
|
||||||
|
if parsedURL.Port() != "" {
|
||||||
|
parsedPort, err := strconv.Atoi(parsedURL.Port())
|
||||||
|
if err != nil {
|
||||||
|
return nil, &DsnParseError{"invalid port"}
|
||||||
|
}
|
||||||
|
port = parsedPort
|
||||||
|
} else {
|
||||||
|
port = scheme.defaultPort()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProjectID
|
||||||
|
if len(parsedURL.Path) == 0 || parsedURL.Path == "/" {
|
||||||
|
return nil, &DsnParseError{"empty project id"}
|
||||||
|
}
|
||||||
|
pathSegments := strings.Split(parsedURL.Path[1:], "/")
|
||||||
|
projectID, err := strconv.Atoi(pathSegments[len(pathSegments)-1])
|
||||||
|
if err != nil {
|
||||||
|
return nil, &DsnParseError{"invalid project id"}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Path
|
||||||
|
var path string
|
||||||
|
if len(pathSegments) > 1 {
|
||||||
|
path = "/" + strings.Join(pathSegments[0:len(pathSegments)-1], "/")
|
||||||
|
}
|
||||||
|
|
||||||
|
return &Dsn{
|
||||||
|
scheme: scheme,
|
||||||
|
publicKey: publicKey,
|
||||||
|
secretKey: secretKey,
|
||||||
|
host: host,
|
||||||
|
port: port,
|
||||||
|
path: path,
|
||||||
|
projectID: projectID,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// String formats Dsn struct into a valid string url
|
||||||
|
func (dsn Dsn) String() string {
|
||||||
|
var url string
|
||||||
|
url += fmt.Sprintf("%s://%s", dsn.scheme, dsn.publicKey)
|
||||||
|
if dsn.secretKey != "" {
|
||||||
|
url += fmt.Sprintf(":%s", dsn.secretKey)
|
||||||
|
}
|
||||||
|
url += fmt.Sprintf("@%s", dsn.host)
|
||||||
|
if dsn.port != dsn.scheme.defaultPort() {
|
||||||
|
url += fmt.Sprintf(":%d", dsn.port)
|
||||||
|
}
|
||||||
|
if dsn.path != "" {
|
||||||
|
url += dsn.path
|
||||||
|
}
|
||||||
|
url += fmt.Sprintf("/%d", dsn.projectID)
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
|
// StoreAPIURL returns assembled url to be used in the transport.
|
||||||
|
// It points to configures Sentry instance.
|
||||||
|
func (dsn Dsn) StoreAPIURL() *url.URL {
|
||||||
|
var rawURL string
|
||||||
|
rawURL += fmt.Sprintf("%s://%s", dsn.scheme, dsn.host)
|
||||||
|
if dsn.port != dsn.scheme.defaultPort() {
|
||||||
|
rawURL += fmt.Sprintf(":%d", dsn.port)
|
||||||
|
}
|
||||||
|
if dsn.path != "" {
|
||||||
|
rawURL += dsn.path
|
||||||
|
}
|
||||||
|
rawURL += fmt.Sprintf("/api/%d/store/", dsn.projectID)
|
||||||
|
parsedURL, _ := url.Parse(rawURL)
|
||||||
|
return parsedURL
|
||||||
|
}
|
||||||
|
|
||||||
|
// RequestHeaders returns all the necessary headers that have to be used in the transport.
|
||||||
|
func (dsn Dsn) RequestHeaders() map[string]string {
|
||||||
|
auth := fmt.Sprintf("Sentry sentry_version=%s, sentry_timestamp=%d, "+
|
||||||
|
"sentry_client=sentry.go/%s, sentry_key=%s", apiVersion, time.Now().Unix(), Version, dsn.publicKey)
|
||||||
|
|
||||||
|
if dsn.secretKey != "" {
|
||||||
|
auth = fmt.Sprintf("%s, sentry_secret=%s", auth, dsn.secretKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
return map[string]string{
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Sentry-Auth": auth,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dsn Dsn) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(dsn.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dsn *Dsn) UnmarshalJSON(data []byte) error {
|
||||||
|
var str string
|
||||||
|
_ = json.Unmarshal(data, &str)
|
||||||
|
newDsn, err := NewDsn(str)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*dsn = *newDsn
|
||||||
|
return nil
|
||||||
|
}
|
35
vendor/github.com/getsentry/sentry-go/go.mod
generated
vendored
Normal file
35
vendor/github.com/getsentry/sentry-go/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
module github.com/getsentry/sentry-go
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/ajg/form v1.5.1 // indirect
|
||||||
|
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
|
||||||
|
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
|
||||||
|
github.com/gin-gonic/gin v1.4.0
|
||||||
|
github.com/go-errors/errors v1.0.1
|
||||||
|
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab
|
||||||
|
github.com/google/go-cmp v0.4.0
|
||||||
|
github.com/google/go-querystring v1.0.0 // indirect
|
||||||
|
github.com/imkira/go-interpol v1.1.0 // indirect
|
||||||
|
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
|
||||||
|
github.com/kataras/iris/v12 v12.0.1
|
||||||
|
github.com/labstack/echo/v4 v4.1.11
|
||||||
|
github.com/moul/http2curl v1.0.0 // indirect
|
||||||
|
github.com/onsi/ginkgo v1.10.3 // indirect
|
||||||
|
github.com/onsi/gomega v1.7.1 // indirect
|
||||||
|
github.com/pingcap/errors v0.11.4
|
||||||
|
github.com/pkg/errors v0.8.1
|
||||||
|
github.com/sergi/go-diff v1.0.0 // indirect
|
||||||
|
github.com/smartystreets/goconvey v1.6.4 // indirect
|
||||||
|
github.com/ugorji/go v1.1.7 // indirect
|
||||||
|
github.com/urfave/negroni v1.0.0
|
||||||
|
github.com/valyala/fasthttp v1.6.0
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||||
|
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
|
||||||
|
github.com/yudai/gojsondiff v1.0.0 // indirect
|
||||||
|
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
|
||||||
|
github.com/yudai/pp v2.0.1+incompatible // indirect
|
||||||
|
)
|
||||||
|
|
||||||
|
replace github.com/ugorji/go v1.1.4 => github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43
|
250
vendor/github.com/getsentry/sentry-go/go.sum
generated
vendored
Normal file
250
vendor/github.com/getsentry/sentry-go/go.sum
generated
vendored
Normal file
|
@ -0,0 +1,250 @@
|
||||||
|
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
|
||||||
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a h1:3SgJcK9l5uPdBC/X17wanyJAMxM33+4ZhEIV96MIH8U=
|
||||||
|
github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw=
|
||||||
|
github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible h1:rZgFj+Gtf3NMi/U5FvCvhzaxzW/TaPYgUYx3bAPz9DE=
|
||||||
|
github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w=
|
||||||
|
github.com/Joker/hpp v1.0.0 h1:65+iuJYdRXv/XyN62C1uEmmOx3432rNG/rKlX6V7Kkc=
|
||||||
|
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
|
||||||
|
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7 h1:mreN1m/5VJ/Zc3b4pzj9qU6D9SRQ6Vm+3KfI328t3S8=
|
||||||
|
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM=
|
||||||
|
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 h1:WDC6ySpJzbxGWFh4aMxFFC28wwGp5pEuoTtvA4q/qQ4=
|
||||||
|
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
|
||||||
|
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
|
||||||
|
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||||
|
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||||
|
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible h1:Ppm0npCCsmuR9oQaBtRuZcmILVE74aXE+AmrJj8L2ns=
|
||||||
|
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
|
||||||
|
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q=
|
||||||
|
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
|
||||||
|
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||||
|
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||||
|
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
|
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
||||||
|
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||||
|
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o=
|
||||||
|
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
|
||||||
|
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
|
||||||
|
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 h1:DddqAaWDpywytcG8w/qoQ5sAN8X12d3Z3koB0C3Rxsc=
|
||||||
|
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
|
||||||
|
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||||
|
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||||
|
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4 h1:GY1+t5Dr9OKADM64SYnQjw/w99HMYvQ0A8/JoUkxVmc=
|
||||||
|
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8=
|
||||||
|
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
|
||||||
|
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g=
|
||||||
|
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
|
||||||
|
github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ=
|
||||||
|
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
|
||||||
|
github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI=
|
||||||
|
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
|
||||||
|
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
|
||||||
|
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||||
|
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk=
|
||||||
|
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
||||||
|
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
|
||||||
|
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||||
|
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||||
|
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||||
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||||
|
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||||
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
|
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
|
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk=
|
||||||
|
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
|
||||||
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
|
github.com/iris-contrib/blackfriday v2.0.0+incompatible h1:o5sHQHHm0ToHUlAJSTjW9UWicjJSDDauOOQ2AHuIVp4=
|
||||||
|
github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI=
|
||||||
|
github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0=
|
||||||
|
github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI=
|
||||||
|
github.com/iris-contrib/schema v0.0.1 h1:10g/WnoRR+U+XXHWKBHeNy/+tZmM2kcAVGLOsz+yaDA=
|
||||||
|
github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw=
|
||||||
|
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
|
||||||
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
|
github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5 h1:rhqTjzJlm7EbkELJDKMTU7udov+Se0xZkWmugr6zGok=
|
||||||
|
github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
|
||||||
|
github.com/juju/loggo v0.0.0-20180524022052-584905176618 h1:MK144iBQF9hTSwBW/9eJm034bVoG30IshVm688T2hi8=
|
||||||
|
github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
|
||||||
|
github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073 h1:WQM1NildKThwdP7qWrNAFGzp4ijNLw8RlgENkaI4MJs=
|
||||||
|
github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
|
||||||
|
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM=
|
||||||
|
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
|
||||||
|
github.com/kataras/golog v0.0.9 h1:J7Dl82843nbKQDrQM/abbNJZvQjS6PfmkkffhOTXEpM=
|
||||||
|
github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk=
|
||||||
|
github.com/kataras/iris/v12 v12.0.1 h1:Wo5S7GMWv5OAzJmvFTvss/C4TS1W0uo6LkDlSymT4rM=
|
||||||
|
github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U=
|
||||||
|
github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw=
|
||||||
|
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d h1:V5Rs9ztEWdp58oayPq/ulmlqJJZeJP6pP79uP3qjcao=
|
||||||
|
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0=
|
||||||
|
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
|
github.com/klauspost/compress v1.9.0 h1:GhthINjveNZAdFUD8QoQYfjxnOONZgztK/Yr6M23UTY=
|
||||||
|
github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
|
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/labstack/echo/v4 v4.1.11 h1:z0BZoArY4FqdpUEl+wlHp4hnr/oSR6MTmQmv8OHSoww=
|
||||||
|
github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
|
||||||
|
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
|
||||||
|
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
|
||||||
|
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
|
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
||||||
|
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
|
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
||||||
|
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||||
|
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
|
||||||
|
github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg=
|
||||||
|
github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ=
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s=
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
|
||||||
|
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
|
||||||
|
github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM=
|
||||||
|
github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4=
|
||||||
|
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY=
|
||||||
|
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
|
||||||
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||||
|
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||||
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUWQxHW5TkBe7YUl+2s=
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||||
|
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
|
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||||
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/ugorji/go v1.1.2/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
|
||||||
|
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||||
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
|
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 h1:3SVOIvH7Ae1KRYyQWRjXWJEA9sS/c/pjvH++55Gr648=
|
||||||
|
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||||
|
github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43 h1:BasDe+IErOQKrMVXab7UayvSlIpiyGwRvuX3EKYY7UA=
|
||||||
|
github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43/go.mod h1:iT03XoTwV7xq/+UGwKO3UbC1nNNlopQiY61beSdrtOA=
|
||||||
|
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||||
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
|
github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc=
|
||||||
|
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
|
github.com/valyala/fasthttp v1.6.0 h1:uWF8lgKmeaIewWVPwi4GRq2P6+R46IgYZdxWtM+GtEY=
|
||||||
|
github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
|
||||||
|
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
|
||||||
|
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||||
|
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
|
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 h1:6fRhSjgLCkTD3JnJxvaJ4Sj+TYblw757bqYgZaOq5ZY=
|
||||||
|
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
|
||||||
|
github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA=
|
||||||
|
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
|
||||||
|
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M=
|
||||||
|
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
|
||||||
|
github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI=
|
||||||
|
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
|
||||||
|
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=
|
||||||
|
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||||
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
|
||||||
|
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||||
|
gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ=
|
||||||
|
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
|
||||||
|
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce h1:xcEWjVhvbDy+nHP67nPDDpbYrY+ILlfndk4bRioVHaU=
|
||||||
|
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
364
vendor/github.com/getsentry/sentry-go/hub.go
generated
vendored
Normal file
364
vendor/github.com/getsentry/sentry-go/hub.go
generated
vendored
Normal file
|
@ -0,0 +1,364 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type contextKey int
|
||||||
|
|
||||||
|
// HubContextKey is a context key used to store Hub on any context.Context type
|
||||||
|
const HubContextKey = contextKey(1)
|
||||||
|
|
||||||
|
// RequestContextKey is a context key used to store http.Request on the context passed to RecoverWithContext
|
||||||
|
const RequestContextKey = contextKey(2)
|
||||||
|
|
||||||
|
// Default maximum number of breadcrumbs added to an event. Can be overwritten `maxBreadcrumbs` option.
|
||||||
|
const defaultMaxBreadcrumbs = 30
|
||||||
|
|
||||||
|
// Absolute maximum number of breadcrumbs added to an event.
|
||||||
|
// The `maxBreadcrumbs` option cannot be higher than this value.
|
||||||
|
const maxBreadcrumbs = 100
|
||||||
|
|
||||||
|
// Initial instance of the Hub that has no `Client` bound and an empty `Scope`
|
||||||
|
var currentHub = NewHub(nil, NewScope()) //nolint: gochecknoglobals
|
||||||
|
|
||||||
|
// Hub is the central object that manages scopes and clients.
|
||||||
|
//
|
||||||
|
// This can be used to capture events and manage the scope.
|
||||||
|
// The default hub that is available automatically.
|
||||||
|
//
|
||||||
|
// In most situations developers do not need to interface the hub. Instead
|
||||||
|
// toplevel convenience functions are exposed that will automatically dispatch
|
||||||
|
// to global (`CurrentHub`) hub. In some situations this might not be
|
||||||
|
// possible in which case it might become necessary to manually work with the
|
||||||
|
// hub. This is for instance the case when working with async code.
|
||||||
|
type Hub struct {
|
||||||
|
mu sync.RWMutex
|
||||||
|
stack *stack
|
||||||
|
lastEventID EventID
|
||||||
|
}
|
||||||
|
|
||||||
|
type layer struct {
|
||||||
|
// mu protects concurrent reads and writes to client.
|
||||||
|
mu sync.RWMutex
|
||||||
|
client *Client
|
||||||
|
// scope is read-only, not protected by mu.
|
||||||
|
scope *Scope
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client returns the layer's client. Safe for concurrent use.
|
||||||
|
func (l *layer) Client() *Client {
|
||||||
|
l.mu.RLock()
|
||||||
|
defer l.mu.RUnlock()
|
||||||
|
return l.client
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetClient sets the layer's client. Safe for concurrent use.
|
||||||
|
func (l *layer) SetClient(c *Client) {
|
||||||
|
l.mu.Lock()
|
||||||
|
defer l.mu.Unlock()
|
||||||
|
l.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
type stack []*layer
|
||||||
|
|
||||||
|
// NewHub returns an instance of a `Hub` with provided `Client` and `Scope` bound.
|
||||||
|
func NewHub(client *Client, scope *Scope) *Hub {
|
||||||
|
hub := Hub{
|
||||||
|
stack: &stack{{
|
||||||
|
client: client,
|
||||||
|
scope: scope,
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
return &hub
|
||||||
|
}
|
||||||
|
|
||||||
|
// CurrentHub returns an instance of previously initialized `Hub` stored in the global namespace.
|
||||||
|
func CurrentHub() *Hub {
|
||||||
|
return currentHub
|
||||||
|
}
|
||||||
|
|
||||||
|
// LastEventID returns an ID of last captured event for the current `Hub`.
|
||||||
|
func (hub *Hub) LastEventID() EventID {
|
||||||
|
return hub.lastEventID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (hub *Hub) stackTop() *layer {
|
||||||
|
hub.mu.RLock()
|
||||||
|
defer hub.mu.RUnlock()
|
||||||
|
|
||||||
|
stack := hub.stack
|
||||||
|
if stack == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
stackLen := len(*stack)
|
||||||
|
if stackLen == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
top := (*stack)[stackLen-1]
|
||||||
|
|
||||||
|
return top
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone returns a copy of the current Hub with top-most scope and client copied over.
|
||||||
|
func (hub *Hub) Clone() *Hub {
|
||||||
|
top := hub.stackTop()
|
||||||
|
if top == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
scope := top.scope
|
||||||
|
if scope != nil {
|
||||||
|
scope = scope.Clone()
|
||||||
|
}
|
||||||
|
return NewHub(top.Client(), scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scope returns top-level `Scope` of the current `Hub` or `nil` if no `Scope` is bound.
|
||||||
|
func (hub *Hub) Scope() *Scope {
|
||||||
|
top := hub.stackTop()
|
||||||
|
if top == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return top.scope
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scope returns top-level `Client` of the current `Hub` or `nil` if no `Client` is bound.
|
||||||
|
func (hub *Hub) Client() *Client {
|
||||||
|
top := hub.stackTop()
|
||||||
|
if top == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return top.Client()
|
||||||
|
}
|
||||||
|
|
||||||
|
// PushScope pushes a new scope for the current `Hub` and reuses previously bound `Client`.
|
||||||
|
func (hub *Hub) PushScope() *Scope {
|
||||||
|
top := hub.stackTop()
|
||||||
|
|
||||||
|
var client *Client
|
||||||
|
if top != nil {
|
||||||
|
client = top.Client()
|
||||||
|
}
|
||||||
|
|
||||||
|
var scope *Scope
|
||||||
|
if top != nil && top.scope != nil {
|
||||||
|
scope = top.scope.Clone()
|
||||||
|
} else {
|
||||||
|
scope = NewScope()
|
||||||
|
}
|
||||||
|
|
||||||
|
hub.mu.Lock()
|
||||||
|
defer hub.mu.Unlock()
|
||||||
|
|
||||||
|
*hub.stack = append(*hub.stack, &layer{
|
||||||
|
client: client,
|
||||||
|
scope: scope,
|
||||||
|
})
|
||||||
|
|
||||||
|
return scope
|
||||||
|
}
|
||||||
|
|
||||||
|
// PushScope pops the most recent scope for the current `Hub`.
|
||||||
|
func (hub *Hub) PopScope() {
|
||||||
|
hub.mu.Lock()
|
||||||
|
defer hub.mu.Unlock()
|
||||||
|
|
||||||
|
stack := *hub.stack
|
||||||
|
stackLen := len(stack)
|
||||||
|
if stackLen > 0 {
|
||||||
|
*hub.stack = stack[0 : stackLen-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// BindClient binds a new `Client` for the current `Hub`.
|
||||||
|
func (hub *Hub) BindClient(client *Client) {
|
||||||
|
top := hub.stackTop()
|
||||||
|
if top != nil {
|
||||||
|
top.SetClient(client)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithScope temporarily pushes a scope for a single call.
|
||||||
|
//
|
||||||
|
// A shorthand for:
|
||||||
|
// PushScope()
|
||||||
|
// f(scope)
|
||||||
|
// PopScope()
|
||||||
|
func (hub *Hub) WithScope(f func(scope *Scope)) {
|
||||||
|
scope := hub.PushScope()
|
||||||
|
defer hub.PopScope()
|
||||||
|
f(scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigureScope invokes a function that can modify the current scope.
|
||||||
|
//
|
||||||
|
// The function is passed a mutable reference to the `Scope` so that modifications
|
||||||
|
// can be performed.
|
||||||
|
func (hub *Hub) ConfigureScope(f func(scope *Scope)) {
|
||||||
|
scope := hub.Scope()
|
||||||
|
f(scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureEvent calls the method of a same name on currently bound `Client` instance
|
||||||
|
// passing it a top-level `Scope`.
|
||||||
|
// Returns `EventID` if successfully, or `nil` if there's no `Scope` or `Client` available.
|
||||||
|
func (hub *Hub) CaptureEvent(event *Event) *EventID {
|
||||||
|
client, scope := hub.Client(), hub.Scope()
|
||||||
|
if client == nil || scope == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
eventID := client.CaptureEvent(event, nil, scope)
|
||||||
|
if eventID != nil {
|
||||||
|
hub.lastEventID = *eventID
|
||||||
|
} else {
|
||||||
|
hub.lastEventID = ""
|
||||||
|
}
|
||||||
|
return eventID
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureMessage calls the method of a same name on currently bound `Client` instance
|
||||||
|
// passing it a top-level `Scope`.
|
||||||
|
// Returns `EventID` if successfully, or `nil` if there's no `Scope` or `Client` available.
|
||||||
|
func (hub *Hub) CaptureMessage(message string) *EventID {
|
||||||
|
client, scope := hub.Client(), hub.Scope()
|
||||||
|
if client == nil || scope == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
eventID := client.CaptureMessage(message, nil, scope)
|
||||||
|
if eventID != nil {
|
||||||
|
hub.lastEventID = *eventID
|
||||||
|
} else {
|
||||||
|
hub.lastEventID = ""
|
||||||
|
}
|
||||||
|
return eventID
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureException calls the method of a same name on currently bound `Client` instance
|
||||||
|
// passing it a top-level `Scope`.
|
||||||
|
// Returns `EventID` if successfully, or `nil` if there's no `Scope` or `Client` available.
|
||||||
|
func (hub *Hub) CaptureException(exception error) *EventID {
|
||||||
|
client, scope := hub.Client(), hub.Scope()
|
||||||
|
if client == nil || scope == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
eventID := client.CaptureException(exception, &EventHint{OriginalException: exception}, scope)
|
||||||
|
if eventID != nil {
|
||||||
|
hub.lastEventID = *eventID
|
||||||
|
} else {
|
||||||
|
hub.lastEventID = ""
|
||||||
|
}
|
||||||
|
return eventID
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddBreadcrumb records a new breadcrumb.
|
||||||
|
//
|
||||||
|
// The total number of breadcrumbs that can be recorded are limited by the
|
||||||
|
// configuration on the client.
|
||||||
|
func (hub *Hub) AddBreadcrumb(breadcrumb *Breadcrumb, hint *BreadcrumbHint) {
|
||||||
|
client := hub.Client()
|
||||||
|
|
||||||
|
// If there's no client, just store it on the scope straight away
|
||||||
|
if client == nil {
|
||||||
|
hub.Scope().AddBreadcrumb(breadcrumb, maxBreadcrumbs)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
options := client.Options()
|
||||||
|
max := defaultMaxBreadcrumbs
|
||||||
|
|
||||||
|
if options.MaxBreadcrumbs != 0 {
|
||||||
|
max = options.MaxBreadcrumbs
|
||||||
|
}
|
||||||
|
|
||||||
|
if max < 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.BeforeBreadcrumb != nil {
|
||||||
|
h := &BreadcrumbHint{}
|
||||||
|
if hint != nil {
|
||||||
|
h = hint
|
||||||
|
}
|
||||||
|
if breadcrumb = options.BeforeBreadcrumb(breadcrumb, h); breadcrumb == nil {
|
||||||
|
Logger.Println("breadcrumb dropped due to BeforeBreadcrumb callback.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if max > maxBreadcrumbs {
|
||||||
|
max = maxBreadcrumbs
|
||||||
|
}
|
||||||
|
hub.Scope().AddBreadcrumb(breadcrumb, max)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover calls the method of a same name on currently bound `Client` instance
|
||||||
|
// passing it a top-level `Scope`.
|
||||||
|
// Returns `EventID` if successfully, or `nil` if there's no `Scope` or `Client` available.
|
||||||
|
func (hub *Hub) Recover(err interface{}) *EventID {
|
||||||
|
if err == nil {
|
||||||
|
err = recover()
|
||||||
|
}
|
||||||
|
client, scope := hub.Client(), hub.Scope()
|
||||||
|
if client == nil || scope == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return client.Recover(err, &EventHint{RecoveredException: err}, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RecoverWithContext calls the method of a same name on currently bound `Client` instance
|
||||||
|
// passing it a top-level `Scope`.
|
||||||
|
// Returns `EventID` if successfully, or `nil` if there's no `Scope` or `Client` available.
|
||||||
|
func (hub *Hub) RecoverWithContext(ctx context.Context, err interface{}) *EventID {
|
||||||
|
if err == nil {
|
||||||
|
err = recover()
|
||||||
|
}
|
||||||
|
client, scope := hub.Client(), hub.Scope()
|
||||||
|
if client == nil || scope == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return client.RecoverWithContext(ctx, err, &EventHint{RecoveredException: err}, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush waits until the underlying Transport sends any buffered events to the
|
||||||
|
// Sentry server, blocking for at most the given timeout. It returns false if
|
||||||
|
// the timeout was reached. In that case, some events may not have been sent.
|
||||||
|
//
|
||||||
|
// Flush should be called before terminating the program to avoid
|
||||||
|
// unintentionally dropping events.
|
||||||
|
//
|
||||||
|
// Do not call Flush indiscriminately after every call to CaptureEvent,
|
||||||
|
// CaptureException or CaptureMessage. Instead, to have the SDK send events over
|
||||||
|
// the network synchronously, configure it to use the HTTPSyncTransport in the
|
||||||
|
// call to Init.
|
||||||
|
func (hub *Hub) Flush(timeout time.Duration) bool {
|
||||||
|
client := hub.Client()
|
||||||
|
|
||||||
|
if client == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return client.Flush(timeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasHubOnContext checks whether `Hub` instance is bound to a given `Context` struct.
|
||||||
|
func HasHubOnContext(ctx context.Context) bool {
|
||||||
|
_, ok := ctx.Value(HubContextKey).(*Hub)
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHubFromContext tries to retrieve `Hub` instance from the given `Context` struct
|
||||||
|
// or return `nil` if one is not found.
|
||||||
|
func GetHubFromContext(ctx context.Context) *Hub {
|
||||||
|
if hub, ok := ctx.Value(HubContextKey).(*Hub); ok {
|
||||||
|
return hub
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHubOnContext stores given `Hub` instance on the `Context` struct and returns a new `Context`.
|
||||||
|
func SetHubOnContext(ctx context.Context, hub *Hub) context.Context {
|
||||||
|
return context.WithValue(ctx, HubContextKey, hub)
|
||||||
|
}
|
271
vendor/github.com/getsentry/sentry-go/integrations.go
generated
vendored
Normal file
271
vendor/github.com/getsentry/sentry-go/integrations.go
generated
vendored
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ================================
|
||||||
|
// Modules Integration
|
||||||
|
// ================================
|
||||||
|
|
||||||
|
type modulesIntegration struct {
|
||||||
|
once sync.Once
|
||||||
|
modules map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mi *modulesIntegration) Name() string {
|
||||||
|
return "Modules"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mi *modulesIntegration) SetupOnce(client *Client) {
|
||||||
|
client.AddEventProcessor(mi.processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mi *modulesIntegration) processor(event *Event, hint *EventHint) *Event {
|
||||||
|
if len(event.Modules) == 0 {
|
||||||
|
mi.once.Do(func() {
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
Logger.Print("The Modules integration is not available in binaries built without module support.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
mi.modules = extractModules(info)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
event.Modules = mi.modules
|
||||||
|
return event
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractModules(info *debug.BuildInfo) map[string]string {
|
||||||
|
modules := map[string]string{
|
||||||
|
info.Main.Path: info.Main.Version,
|
||||||
|
}
|
||||||
|
for _, dep := range info.Deps {
|
||||||
|
ver := dep.Version
|
||||||
|
if dep.Replace != nil {
|
||||||
|
ver += fmt.Sprintf(" => %s %s", dep.Replace.Path, dep.Replace.Version)
|
||||||
|
}
|
||||||
|
modules[dep.Path] = strings.TrimSuffix(ver, " ")
|
||||||
|
}
|
||||||
|
return modules
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================
|
||||||
|
// Environment Integration
|
||||||
|
// ================================
|
||||||
|
|
||||||
|
type environmentIntegration struct{}
|
||||||
|
|
||||||
|
func (ei *environmentIntegration) Name() string {
|
||||||
|
return "Environment"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ei *environmentIntegration) SetupOnce(client *Client) {
|
||||||
|
client.AddEventProcessor(ei.processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ei *environmentIntegration) processor(event *Event, hint *EventHint) *Event {
|
||||||
|
if event.Contexts == nil {
|
||||||
|
event.Contexts = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Contexts["device"] = map[string]interface{}{
|
||||||
|
"arch": runtime.GOARCH,
|
||||||
|
"num_cpu": runtime.NumCPU(),
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Contexts["os"] = map[string]interface{}{
|
||||||
|
"name": runtime.GOOS,
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Contexts["runtime"] = map[string]interface{}{
|
||||||
|
"name": "go",
|
||||||
|
"version": runtime.Version(),
|
||||||
|
"go_numroutines": runtime.NumGoroutine(),
|
||||||
|
"go_maxprocs": runtime.GOMAXPROCS(0),
|
||||||
|
"go_numcgocalls": runtime.NumCgoCall(),
|
||||||
|
}
|
||||||
|
|
||||||
|
return event
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================
|
||||||
|
// Ignore Errors Integration
|
||||||
|
// ================================
|
||||||
|
|
||||||
|
type ignoreErrorsIntegration struct {
|
||||||
|
ignoreErrors []*regexp.Regexp
|
||||||
|
}
|
||||||
|
|
||||||
|
func (iei *ignoreErrorsIntegration) Name() string {
|
||||||
|
return "IgnoreErrors"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (iei *ignoreErrorsIntegration) SetupOnce(client *Client) {
|
||||||
|
iei.ignoreErrors = transformStringsIntoRegexps(client.Options().IgnoreErrors)
|
||||||
|
client.AddEventProcessor(iei.processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (iei *ignoreErrorsIntegration) processor(event *Event, hint *EventHint) *Event {
|
||||||
|
suspects := getIgnoreErrorsSuspects(event)
|
||||||
|
|
||||||
|
for _, suspect := range suspects {
|
||||||
|
for _, pattern := range iei.ignoreErrors {
|
||||||
|
if pattern.Match([]byte(suspect)) {
|
||||||
|
Logger.Printf("Event dropped due to being matched by `IgnoreErrors` option."+
|
||||||
|
"| Value matched: %s | Filter used: %s", suspect, pattern)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return event
|
||||||
|
}
|
||||||
|
|
||||||
|
func transformStringsIntoRegexps(strings []string) []*regexp.Regexp {
|
||||||
|
var exprs []*regexp.Regexp
|
||||||
|
|
||||||
|
for _, s := range strings {
|
||||||
|
r, err := regexp.Compile(s)
|
||||||
|
if err == nil {
|
||||||
|
exprs = append(exprs, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return exprs
|
||||||
|
}
|
||||||
|
|
||||||
|
func getIgnoreErrorsSuspects(event *Event) []string {
|
||||||
|
suspects := []string{}
|
||||||
|
|
||||||
|
if event.Message != "" {
|
||||||
|
suspects = append(suspects, event.Message)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, ex := range event.Exception {
|
||||||
|
suspects = append(suspects, ex.Type)
|
||||||
|
suspects = append(suspects, ex.Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return suspects
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================
|
||||||
|
// Contextify Frames Integration
|
||||||
|
// ================================
|
||||||
|
|
||||||
|
type contextifyFramesIntegration struct {
|
||||||
|
sr sourceReader
|
||||||
|
contextLines int
|
||||||
|
cachedLocations sync.Map
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cfi *contextifyFramesIntegration) Name() string {
|
||||||
|
return "ContextifyFrames"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cfi *contextifyFramesIntegration) SetupOnce(client *Client) {
|
||||||
|
cfi.sr = newSourceReader()
|
||||||
|
cfi.contextLines = 5
|
||||||
|
|
||||||
|
client.AddEventProcessor(cfi.processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cfi *contextifyFramesIntegration) processor(event *Event, hint *EventHint) *Event {
|
||||||
|
// Range over all exceptions
|
||||||
|
for _, ex := range event.Exception {
|
||||||
|
// If it has no stacktrace, just bail out
|
||||||
|
if ex.Stacktrace == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it does, it should have frames, so try to contextify them
|
||||||
|
ex.Stacktrace.Frames = cfi.contextify(ex.Stacktrace.Frames)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Range over all threads
|
||||||
|
for _, th := range event.Threads {
|
||||||
|
// If it has no stacktrace, just bail out
|
||||||
|
if th.Stacktrace == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it does, it should have frames, so try to contextify them
|
||||||
|
th.Stacktrace.Frames = cfi.contextify(th.Stacktrace.Frames)
|
||||||
|
}
|
||||||
|
|
||||||
|
return event
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cfi *contextifyFramesIntegration) contextify(frames []Frame) []Frame {
|
||||||
|
contextifiedFrames := make([]Frame, 0, len(frames))
|
||||||
|
|
||||||
|
for _, frame := range frames {
|
||||||
|
if !frame.InApp {
|
||||||
|
contextifiedFrames = append(contextifiedFrames, frame)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
var path string
|
||||||
|
|
||||||
|
if cachedPath, ok := cfi.cachedLocations.Load(frame.AbsPath); ok {
|
||||||
|
if p, ok := cachedPath.(string); ok {
|
||||||
|
path = p
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Optimize for happy path here
|
||||||
|
if fileExists(frame.AbsPath) {
|
||||||
|
path = frame.AbsPath
|
||||||
|
} else {
|
||||||
|
path = cfi.findNearbySourceCodeLocation(frame.AbsPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if path == "" {
|
||||||
|
contextifiedFrames = append(contextifiedFrames, frame)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
lines, contextLine := cfi.sr.readContextLines(path, frame.Lineno, cfi.contextLines)
|
||||||
|
contextifiedFrames = append(contextifiedFrames, cfi.addContextLinesToFrame(frame, lines, contextLine))
|
||||||
|
}
|
||||||
|
|
||||||
|
return contextifiedFrames
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cfi *contextifyFramesIntegration) findNearbySourceCodeLocation(originalPath string) string {
|
||||||
|
trimmedPath := strings.TrimPrefix(originalPath, "/")
|
||||||
|
components := strings.Split(trimmedPath, "/")
|
||||||
|
|
||||||
|
for len(components) > 0 {
|
||||||
|
components = components[1:]
|
||||||
|
possibleLocation := strings.Join(components, "/")
|
||||||
|
|
||||||
|
if fileExists(possibleLocation) {
|
||||||
|
cfi.cachedLocations.Store(originalPath, possibleLocation)
|
||||||
|
return possibleLocation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cfi.cachedLocations.Store(originalPath, "")
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cfi *contextifyFramesIntegration) addContextLinesToFrame(frame Frame, lines [][]byte, contextLine int) Frame {
|
||||||
|
for i, line := range lines {
|
||||||
|
switch {
|
||||||
|
case i < contextLine:
|
||||||
|
frame.PreContext = append(frame.PreContext, string(line))
|
||||||
|
case i == contextLine:
|
||||||
|
frame.ContextLine = string(line)
|
||||||
|
default:
|
||||||
|
frame.PostContext = append(frame.PostContext, string(line))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return frame
|
||||||
|
}
|
221
vendor/github.com/getsentry/sentry-go/interfaces.go
generated
vendored
Normal file
221
vendor/github.com/getsentry/sentry-go/interfaces.go
generated
vendored
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Protocol Docs (kinda)
|
||||||
|
// https://github.com/getsentry/rust-sentry-types/blob/master/src/protocol/v7.rs
|
||||||
|
|
||||||
|
// Level marks the severity of the event
|
||||||
|
type Level string
|
||||||
|
|
||||||
|
const (
|
||||||
|
LevelDebug Level = "debug"
|
||||||
|
LevelInfo Level = "info"
|
||||||
|
LevelWarning Level = "warning"
|
||||||
|
LevelError Level = "error"
|
||||||
|
LevelFatal Level = "fatal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// https://docs.sentry.io/development/sdk-dev/event-payloads/sdk/
|
||||||
|
type SdkInfo struct {
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Version string `json:"version,omitempty"`
|
||||||
|
Integrations []string `json:"integrations,omitempty"`
|
||||||
|
Packages []SdkPackage `json:"packages,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SdkPackage struct {
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Version string `json:"version,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: This type could be more useful, as map of interface{} is too generic
|
||||||
|
// and requires a lot of type assertions in beforeBreadcrumb calls
|
||||||
|
// plus it could just be `map[string]interface{}` then
|
||||||
|
type BreadcrumbHint map[string]interface{}
|
||||||
|
|
||||||
|
// https://docs.sentry.io/development/sdk-dev/event-payloads/breadcrumbs/
|
||||||
|
type Breadcrumb struct {
|
||||||
|
Category string `json:"category,omitempty"`
|
||||||
|
Data map[string]interface{} `json:"data,omitempty"`
|
||||||
|
Level Level `json:"level,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
|
Timestamp time.Time `json:"timestamp"`
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *Breadcrumb) MarshalJSON() ([]byte, error) {
|
||||||
|
type alias Breadcrumb
|
||||||
|
// encoding/json doesn't support the "omitempty" option for struct types.
|
||||||
|
// See https://golang.org/issues/11939.
|
||||||
|
// This implementation of MarshalJSON shadows the original Timestamp field
|
||||||
|
// forcing it to be omitted when the Timestamp is the zero value of
|
||||||
|
// time.Time.
|
||||||
|
if b.Timestamp.IsZero() {
|
||||||
|
return json.Marshal(&struct {
|
||||||
|
*alias
|
||||||
|
Timestamp json.RawMessage `json:"timestamp,omitempty"`
|
||||||
|
}{
|
||||||
|
alias: (*alias)(b),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return json.Marshal(&struct {
|
||||||
|
*alias
|
||||||
|
}{
|
||||||
|
alias: (*alias)(b),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.sentry.io/development/sdk-dev/event-payloads/user/
|
||||||
|
type User struct {
|
||||||
|
Email string `json:"email,omitempty"`
|
||||||
|
ID string `json:"id,omitempty"`
|
||||||
|
IPAddress string `json:"ip_address,omitempty"`
|
||||||
|
Username string `json:"username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.sentry.io/development/sdk-dev/event-payloads/request/
|
||||||
|
type Request struct {
|
||||||
|
URL string `json:"url,omitempty"`
|
||||||
|
Method string `json:"method,omitempty"`
|
||||||
|
Data string `json:"data,omitempty"`
|
||||||
|
QueryString string `json:"query_string,omitempty"`
|
||||||
|
Cookies string `json:"cookies,omitempty"`
|
||||||
|
Headers map[string]string `json:"headers,omitempty"`
|
||||||
|
Env map[string]string `json:"env,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewRequest returns a new Sentry Request from the given http.Request.
|
||||||
|
//
|
||||||
|
// NewRequest avoids operations that depend on network access. In particular, it
|
||||||
|
// does not read r.Body.
|
||||||
|
func NewRequest(r *http.Request) *Request {
|
||||||
|
protocol := schemeHTTP
|
||||||
|
if r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https" {
|
||||||
|
protocol = schemeHTTPS
|
||||||
|
}
|
||||||
|
url := fmt.Sprintf("%s://%s%s", protocol, r.Host, r.URL.Path)
|
||||||
|
|
||||||
|
// We read only the first Cookie header because of the specification:
|
||||||
|
// https://tools.ietf.org/html/rfc6265#section-5.4
|
||||||
|
// When the user agent generates an HTTP request, the user agent MUST NOT
|
||||||
|
// attach more than one Cookie header field.
|
||||||
|
cookies := r.Header.Get("Cookie")
|
||||||
|
|
||||||
|
headers := make(map[string]string, len(r.Header))
|
||||||
|
for k, v := range r.Header {
|
||||||
|
headers[k] = strings.Join(v, ",")
|
||||||
|
}
|
||||||
|
headers["Host"] = r.Host
|
||||||
|
|
||||||
|
var env map[string]string
|
||||||
|
if addr, port, err := net.SplitHostPort(r.RemoteAddr); err == nil {
|
||||||
|
env = map[string]string{"REMOTE_ADDR": addr, "REMOTE_PORT": port}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &Request{
|
||||||
|
URL: url,
|
||||||
|
Method: r.Method,
|
||||||
|
QueryString: r.URL.RawQuery,
|
||||||
|
Cookies: cookies,
|
||||||
|
Headers: headers,
|
||||||
|
Env: env,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.sentry.io/development/sdk-dev/event-payloads/exception/
|
||||||
|
type Exception struct {
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
|
Value string `json:"value,omitempty"`
|
||||||
|
Module string `json:"module,omitempty"`
|
||||||
|
ThreadID string `json:"thread_id,omitempty"`
|
||||||
|
Stacktrace *Stacktrace `json:"stacktrace,omitempty"`
|
||||||
|
RawStacktrace *Stacktrace `json:"raw_stacktrace,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type EventID string
|
||||||
|
|
||||||
|
// https://docs.sentry.io/development/sdk-dev/event-payloads/
|
||||||
|
type Event struct {
|
||||||
|
Breadcrumbs []*Breadcrumb `json:"breadcrumbs,omitempty"`
|
||||||
|
Contexts map[string]interface{} `json:"contexts,omitempty"`
|
||||||
|
Dist string `json:"dist,omitempty"`
|
||||||
|
Environment string `json:"environment,omitempty"`
|
||||||
|
EventID EventID `json:"event_id,omitempty"`
|
||||||
|
Extra map[string]interface{} `json:"extra,omitempty"`
|
||||||
|
Fingerprint []string `json:"fingerprint,omitempty"`
|
||||||
|
Level Level `json:"level,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
|
Platform string `json:"platform,omitempty"`
|
||||||
|
Release string `json:"release,omitempty"`
|
||||||
|
Sdk SdkInfo `json:"sdk,omitempty"`
|
||||||
|
ServerName string `json:"server_name,omitempty"`
|
||||||
|
Threads []Thread `json:"threads,omitempty"`
|
||||||
|
Tags map[string]string `json:"tags,omitempty"`
|
||||||
|
Timestamp time.Time `json:"timestamp"`
|
||||||
|
Transaction string `json:"transaction,omitempty"`
|
||||||
|
User User `json:"user,omitempty"`
|
||||||
|
Logger string `json:"logger,omitempty"`
|
||||||
|
Modules map[string]string `json:"modules,omitempty"`
|
||||||
|
Request *Request `json:"request,omitempty"`
|
||||||
|
Exception []Exception `json:"exception,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Event) MarshalJSON() ([]byte, error) {
|
||||||
|
type alias Event
|
||||||
|
// encoding/json doesn't support the "omitempty" option for struct types.
|
||||||
|
// See https://golang.org/issues/11939.
|
||||||
|
// This implementation of MarshalJSON shadows the original Timestamp field
|
||||||
|
// forcing it to be omitted when the Timestamp is the zero value of
|
||||||
|
// time.Time.
|
||||||
|
if e.Timestamp.IsZero() {
|
||||||
|
return json.Marshal(&struct {
|
||||||
|
*alias
|
||||||
|
Timestamp json.RawMessage `json:"timestamp,omitempty"`
|
||||||
|
}{
|
||||||
|
alias: (*alias)(e),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return json.Marshal(&struct {
|
||||||
|
*alias
|
||||||
|
}{
|
||||||
|
alias: (*alias)(e),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewEvent() *Event {
|
||||||
|
event := Event{
|
||||||
|
Contexts: make(map[string]interface{}),
|
||||||
|
Extra: make(map[string]interface{}),
|
||||||
|
Tags: make(map[string]string),
|
||||||
|
Modules: make(map[string]string),
|
||||||
|
}
|
||||||
|
return &event
|
||||||
|
}
|
||||||
|
|
||||||
|
type Thread struct {
|
||||||
|
ID string `json:"id,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Stacktrace *Stacktrace `json:"stacktrace,omitempty"`
|
||||||
|
RawStacktrace *Stacktrace `json:"raw_stacktrace,omitempty"`
|
||||||
|
Crashed bool `json:"crashed,omitempty"`
|
||||||
|
Current bool `json:"current,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type EventHint struct {
|
||||||
|
Data interface{}
|
||||||
|
EventID string
|
||||||
|
OriginalException error
|
||||||
|
RecoveredException interface{}
|
||||||
|
Context context.Context
|
||||||
|
Request *http.Request
|
||||||
|
Response *http.Response
|
||||||
|
}
|
416
vendor/github.com/getsentry/sentry-go/scope.go
generated
vendored
Normal file
416
vendor/github.com/getsentry/sentry-go/scope.go
generated
vendored
Normal file
|
@ -0,0 +1,416 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"reflect"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Scope holds contextual data for the current scope.
|
||||||
|
//
|
||||||
|
// The scope is an object that can cloned efficiently and stores data that
|
||||||
|
// is locally relevant to an event. For instance the scope will hold recorded
|
||||||
|
// breadcrumbs and similar information.
|
||||||
|
//
|
||||||
|
// The scope can be interacted with in two ways:
|
||||||
|
//
|
||||||
|
// 1. the scope is routinely updated with information by functions such as
|
||||||
|
// `AddBreadcrumb` which will modify the currently top-most scope.
|
||||||
|
// 2. the topmost scope can also be configured through the `ConfigureScope`
|
||||||
|
// method.
|
||||||
|
//
|
||||||
|
// Note that the scope can only be modified but not inspected.
|
||||||
|
// Only the client can use the scope to extract information currently.
|
||||||
|
type Scope struct {
|
||||||
|
mu sync.RWMutex
|
||||||
|
breadcrumbs []*Breadcrumb
|
||||||
|
user User
|
||||||
|
tags map[string]string
|
||||||
|
contexts map[string]interface{}
|
||||||
|
extra map[string]interface{}
|
||||||
|
fingerprint []string
|
||||||
|
level Level
|
||||||
|
transaction string
|
||||||
|
request *http.Request
|
||||||
|
// requestBody holds a reference to the original request.Body.
|
||||||
|
requestBody interface {
|
||||||
|
// Bytes returns bytes from the original body, lazily buffered as the
|
||||||
|
// original body is read.
|
||||||
|
Bytes() []byte
|
||||||
|
// Overflow returns true if the body is larger than the maximum buffer
|
||||||
|
// size.
|
||||||
|
Overflow() bool
|
||||||
|
}
|
||||||
|
eventProcessors []EventProcessor
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewScope() *Scope {
|
||||||
|
scope := Scope{
|
||||||
|
breadcrumbs: make([]*Breadcrumb, 0),
|
||||||
|
tags: make(map[string]string),
|
||||||
|
contexts: make(map[string]interface{}),
|
||||||
|
extra: make(map[string]interface{}),
|
||||||
|
fingerprint: make([]string, 0),
|
||||||
|
}
|
||||||
|
|
||||||
|
return &scope
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddBreadcrumb adds new breadcrumb to the current scope
|
||||||
|
// and optionally throws the old one if limit is reached.
|
||||||
|
func (scope *Scope) AddBreadcrumb(breadcrumb *Breadcrumb, limit int) {
|
||||||
|
if breadcrumb.Timestamp.IsZero() {
|
||||||
|
breadcrumb.Timestamp = time.Now().UTC()
|
||||||
|
}
|
||||||
|
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
breadcrumbs := append(scope.breadcrumbs, breadcrumb)
|
||||||
|
if len(breadcrumbs) > limit {
|
||||||
|
scope.breadcrumbs = breadcrumbs[1 : limit+1]
|
||||||
|
} else {
|
||||||
|
scope.breadcrumbs = breadcrumbs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearBreadcrumbs clears all breadcrumbs from the current scope.
|
||||||
|
func (scope *Scope) ClearBreadcrumbs() {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.breadcrumbs = []*Breadcrumb{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUser sets the user for the current scope.
|
||||||
|
func (scope *Scope) SetUser(user User) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.user = user
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRequest sets the request for the current scope.
|
||||||
|
func (scope *Scope) SetRequest(r *http.Request) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.request = r
|
||||||
|
|
||||||
|
if r == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't buffer request body if we know it is oversized.
|
||||||
|
if r.ContentLength > maxRequestBodyBytes {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Don't buffer if there is no body.
|
||||||
|
if r.Body == nil || r.Body == http.NoBody {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
buf := &limitedBuffer{Capacity: maxRequestBodyBytes}
|
||||||
|
r.Body = readCloser{
|
||||||
|
Reader: io.TeeReader(r.Body, buf),
|
||||||
|
Closer: r.Body,
|
||||||
|
}
|
||||||
|
scope.requestBody = buf
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRequestBody sets the request body for the current scope.
|
||||||
|
//
|
||||||
|
// This method should only be called when the body bytes are already available
|
||||||
|
// in memory. Typically, the request body is buffered lazily from the
|
||||||
|
// Request.Body from SetRequest.
|
||||||
|
func (scope *Scope) SetRequestBody(b []byte) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
capacity := maxRequestBodyBytes
|
||||||
|
overflow := false
|
||||||
|
if len(b) > capacity {
|
||||||
|
overflow = true
|
||||||
|
b = b[:capacity]
|
||||||
|
}
|
||||||
|
scope.requestBody = &limitedBuffer{
|
||||||
|
Capacity: capacity,
|
||||||
|
Buffer: *bytes.NewBuffer(b),
|
||||||
|
overflow: overflow,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// maxRequestBodyBytes is the default maximum request body size to send to
|
||||||
|
// Sentry.
|
||||||
|
const maxRequestBodyBytes = 10 * 1024
|
||||||
|
|
||||||
|
// A limitedBuffer is like a bytes.Buffer, but limited to store at most Capacity
|
||||||
|
// bytes. Any writes past the capacity are silently discarded, similar to
|
||||||
|
// ioutil.Discard.
|
||||||
|
type limitedBuffer struct {
|
||||||
|
Capacity int
|
||||||
|
|
||||||
|
bytes.Buffer
|
||||||
|
overflow bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write implements io.Writer.
|
||||||
|
func (b *limitedBuffer) Write(p []byte) (n int, err error) {
|
||||||
|
// Silently ignore writes after overflow.
|
||||||
|
if b.overflow {
|
||||||
|
return len(p), nil
|
||||||
|
}
|
||||||
|
left := b.Capacity - b.Len()
|
||||||
|
if left < 0 {
|
||||||
|
left = 0
|
||||||
|
}
|
||||||
|
if len(p) > left {
|
||||||
|
b.overflow = true
|
||||||
|
p = p[:left]
|
||||||
|
}
|
||||||
|
return b.Buffer.Write(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overflow returns true if the limitedBuffer discarded bytes written to it.
|
||||||
|
func (b *limitedBuffer) Overflow() bool {
|
||||||
|
return b.overflow
|
||||||
|
}
|
||||||
|
|
||||||
|
// readCloser combines an io.Reader and an io.Closer to implement io.ReadCloser.
|
||||||
|
type readCloser struct {
|
||||||
|
io.Reader
|
||||||
|
io.Closer
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTag adds a tag to the current scope.
|
||||||
|
func (scope *Scope) SetTag(key, value string) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.tags[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTags assigns multiple tags to the current scope.
|
||||||
|
func (scope *Scope) SetTags(tags map[string]string) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
for k, v := range tags {
|
||||||
|
scope.tags[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveTag removes a tag from the current scope.
|
||||||
|
func (scope *Scope) RemoveTag(key string) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
delete(scope.tags, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds a context to the current scope.
|
||||||
|
func (scope *Scope) SetContext(key string, value interface{}) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.contexts[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContexts assigns multiple contexts to the current scope.
|
||||||
|
func (scope *Scope) SetContexts(contexts map[string]interface{}) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
for k, v := range contexts {
|
||||||
|
scope.contexts[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveContext removes a context from the current scope.
|
||||||
|
func (scope *Scope) RemoveContext(key string) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
delete(scope.contexts, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExtra adds an extra to the current scope.
|
||||||
|
func (scope *Scope) SetExtra(key string, value interface{}) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.extra[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExtras assigns multiple extras to the current scope.
|
||||||
|
func (scope *Scope) SetExtras(extra map[string]interface{}) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
for k, v := range extra {
|
||||||
|
scope.extra[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveExtra removes a extra from the current scope.
|
||||||
|
func (scope *Scope) RemoveExtra(key string) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
delete(scope.extra, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFingerprint sets new fingerprint for the current scope.
|
||||||
|
func (scope *Scope) SetFingerprint(fingerprint []string) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.fingerprint = fingerprint
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevel sets new level for the current scope.
|
||||||
|
func (scope *Scope) SetLevel(level Level) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.level = level
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransaction sets new transaction name for the current transaction.
|
||||||
|
func (scope *Scope) SetTransaction(transactionName string) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.transaction = transactionName
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone returns a copy of the current scope with all data copied over.
|
||||||
|
func (scope *Scope) Clone() *Scope {
|
||||||
|
scope.mu.RLock()
|
||||||
|
defer scope.mu.RUnlock()
|
||||||
|
|
||||||
|
clone := NewScope()
|
||||||
|
clone.user = scope.user
|
||||||
|
clone.breadcrumbs = make([]*Breadcrumb, len(scope.breadcrumbs))
|
||||||
|
copy(clone.breadcrumbs, scope.breadcrumbs)
|
||||||
|
for key, value := range scope.tags {
|
||||||
|
clone.tags[key] = value
|
||||||
|
}
|
||||||
|
for key, value := range scope.contexts {
|
||||||
|
clone.contexts[key] = value
|
||||||
|
}
|
||||||
|
for key, value := range scope.extra {
|
||||||
|
clone.extra[key] = value
|
||||||
|
}
|
||||||
|
clone.fingerprint = make([]string, len(scope.fingerprint))
|
||||||
|
copy(clone.fingerprint, scope.fingerprint)
|
||||||
|
clone.level = scope.level
|
||||||
|
clone.transaction = scope.transaction
|
||||||
|
clone.request = scope.request
|
||||||
|
|
||||||
|
return clone
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear removes the data from the current scope. Not safe for concurrent use.
|
||||||
|
func (scope *Scope) Clear() {
|
||||||
|
*scope = *NewScope()
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddEventProcessor adds an event processor to the current scope.
|
||||||
|
func (scope *Scope) AddEventProcessor(processor EventProcessor) {
|
||||||
|
scope.mu.Lock()
|
||||||
|
defer scope.mu.Unlock()
|
||||||
|
|
||||||
|
scope.eventProcessors = append(scope.eventProcessors, processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ApplyToEvent takes the data from the current scope and attaches it to the event.
|
||||||
|
func (scope *Scope) ApplyToEvent(event *Event, hint *EventHint) *Event {
|
||||||
|
scope.mu.RLock()
|
||||||
|
defer scope.mu.RUnlock()
|
||||||
|
|
||||||
|
if len(scope.breadcrumbs) > 0 {
|
||||||
|
if event.Breadcrumbs == nil {
|
||||||
|
event.Breadcrumbs = []*Breadcrumb{}
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Breadcrumbs = append(event.Breadcrumbs, scope.breadcrumbs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(scope.tags) > 0 {
|
||||||
|
if event.Tags == nil {
|
||||||
|
event.Tags = make(map[string]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, value := range scope.tags {
|
||||||
|
event.Tags[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(scope.contexts) > 0 {
|
||||||
|
if event.Contexts == nil {
|
||||||
|
event.Contexts = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, value := range scope.contexts {
|
||||||
|
event.Contexts[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(scope.extra) > 0 {
|
||||||
|
if event.Extra == nil {
|
||||||
|
event.Extra = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, value := range scope.extra {
|
||||||
|
event.Extra[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reflect.DeepEqual(event.User, User{})) {
|
||||||
|
event.User = scope.user
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.Fingerprint == nil || len(event.Fingerprint) == 0) &&
|
||||||
|
len(scope.fingerprint) > 0 {
|
||||||
|
event.Fingerprint = make([]string, len(scope.fingerprint))
|
||||||
|
copy(event.Fingerprint, scope.fingerprint)
|
||||||
|
}
|
||||||
|
|
||||||
|
if scope.level != "" {
|
||||||
|
event.Level = scope.level
|
||||||
|
}
|
||||||
|
|
||||||
|
if scope.transaction != "" {
|
||||||
|
event.Transaction = scope.transaction
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.Request == nil && scope.request != nil {
|
||||||
|
event.Request = NewRequest(scope.request)
|
||||||
|
// NOTE: The SDK does not attempt to send partial request body data.
|
||||||
|
//
|
||||||
|
// The reason being that Sentry's ingest pipeline and UI are optimized
|
||||||
|
// to show structured data. Additionally, tooling around PII scrubbing
|
||||||
|
// relies on structured data; truncated request bodies would create
|
||||||
|
// invalid payloads that are more prone to leaking PII data.
|
||||||
|
//
|
||||||
|
// Users can still send more data along their events if they want to,
|
||||||
|
// for example using Event.Extra.
|
||||||
|
if scope.requestBody != nil && !scope.requestBody.Overflow() {
|
||||||
|
event.Request.Data = string(scope.requestBody.Bytes())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, processor := range scope.eventProcessors {
|
||||||
|
id := event.EventID
|
||||||
|
event = processor(event, hint)
|
||||||
|
if event == nil {
|
||||||
|
Logger.Printf("Event dropped by one of the Scope EventProcessors: %s\n", id)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return event
|
||||||
|
}
|
135
vendor/github.com/getsentry/sentry-go/sentry.go
generated
vendored
Normal file
135
vendor/github.com/getsentry/sentry-go/sentry.go
generated
vendored
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Version is the version of the sentry-go SDK.
|
||||||
|
const Version = "0.6.1"
|
||||||
|
|
||||||
|
// apiVersion is the minimum version of the Sentry API compatible with the
|
||||||
|
// sentry-go SDK.
|
||||||
|
const apiVersion = "7"
|
||||||
|
|
||||||
|
// Init initializes whole SDK by creating new `Client` and binding it to the current `Hub`
|
||||||
|
func Init(options ClientOptions) error {
|
||||||
|
hub := CurrentHub()
|
||||||
|
client, err := NewClient(options)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
hub.BindClient(client)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddBreadcrumb records a new breadcrumb.
|
||||||
|
//
|
||||||
|
// The total number of breadcrumbs that can be recorded are limited by the
|
||||||
|
// configuration on the client.
|
||||||
|
func AddBreadcrumb(breadcrumb *Breadcrumb) {
|
||||||
|
hub := CurrentHub()
|
||||||
|
hub.AddBreadcrumb(breadcrumb, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureMessage captures an arbitrary message.
|
||||||
|
func CaptureMessage(message string) *EventID {
|
||||||
|
hub := CurrentHub()
|
||||||
|
return hub.CaptureMessage(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureException captures an error.
|
||||||
|
func CaptureException(exception error) *EventID {
|
||||||
|
hub := CurrentHub()
|
||||||
|
return hub.CaptureException(exception)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CaptureEvent captures an event on the currently active client if any.
|
||||||
|
//
|
||||||
|
// The event must already be assembled. Typically code would instead use
|
||||||
|
// the utility methods like `CaptureException`. The return value is the
|
||||||
|
// event ID. In case Sentry is disabled or event was dropped, the return value will be nil.
|
||||||
|
func CaptureEvent(event *Event) *EventID {
|
||||||
|
hub := CurrentHub()
|
||||||
|
return hub.CaptureEvent(event)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover captures a panic.
|
||||||
|
func Recover() *EventID {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
hub := CurrentHub()
|
||||||
|
return hub.Recover(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover captures a panic and passes relevant context object.
|
||||||
|
func RecoverWithContext(ctx context.Context) *EventID {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
var hub *Hub
|
||||||
|
|
||||||
|
if HasHubOnContext(ctx) {
|
||||||
|
hub = GetHubFromContext(ctx)
|
||||||
|
} else {
|
||||||
|
hub = CurrentHub()
|
||||||
|
}
|
||||||
|
|
||||||
|
return hub.RecoverWithContext(ctx, err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithScope temporarily pushes a scope for a single call.
|
||||||
|
//
|
||||||
|
// This function takes one argument, a callback that executes
|
||||||
|
// in the context of that scope.
|
||||||
|
//
|
||||||
|
// This is useful when extra data should be send with a single capture call
|
||||||
|
// for instance a different level or tags
|
||||||
|
func WithScope(f func(scope *Scope)) {
|
||||||
|
hub := CurrentHub()
|
||||||
|
hub.WithScope(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigureScope invokes a function that can modify the current scope.
|
||||||
|
//
|
||||||
|
// The function is passed a mutable reference to the `Scope` so that modifications
|
||||||
|
// can be performed.
|
||||||
|
func ConfigureScope(f func(scope *Scope)) {
|
||||||
|
hub := CurrentHub()
|
||||||
|
hub.ConfigureScope(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PushScope pushes a new scope.
|
||||||
|
func PushScope() {
|
||||||
|
hub := CurrentHub()
|
||||||
|
hub.PushScope()
|
||||||
|
}
|
||||||
|
|
||||||
|
// PopScope pushes a new scope.
|
||||||
|
func PopScope() {
|
||||||
|
hub := CurrentHub()
|
||||||
|
hub.PopScope()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush waits until the underlying Transport sends any buffered events to the
|
||||||
|
// Sentry server, blocking for at most the given timeout. It returns false if
|
||||||
|
// the timeout was reached. In that case, some events may not have been sent.
|
||||||
|
//
|
||||||
|
// Flush should be called before terminating the program to avoid
|
||||||
|
// unintentionally dropping events.
|
||||||
|
//
|
||||||
|
// Do not call Flush indiscriminately after every call to CaptureEvent,
|
||||||
|
// CaptureException or CaptureMessage. Instead, to have the SDK send events over
|
||||||
|
// the network synchronously, configure it to use the HTTPSyncTransport in the
|
||||||
|
// call to Init.
|
||||||
|
func Flush(timeout time.Duration) bool {
|
||||||
|
hub := CurrentHub()
|
||||||
|
return hub.Flush(timeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LastEventID returns an ID of last captured event.
|
||||||
|
func LastEventID() EventID {
|
||||||
|
hub := CurrentHub()
|
||||||
|
return hub.LastEventID()
|
||||||
|
}
|
69
vendor/github.com/getsentry/sentry-go/sourcereader.go
generated
vendored
Normal file
69
vendor/github.com/getsentry/sentry-go/sourcereader.go
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io/ioutil"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
type sourceReader struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
cache map[string][][]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func newSourceReader() sourceReader {
|
||||||
|
return sourceReader{
|
||||||
|
cache: make(map[string][][]byte),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sr *sourceReader) readContextLines(filename string, line, context int) ([][]byte, int) {
|
||||||
|
sr.mu.Lock()
|
||||||
|
defer sr.mu.Unlock()
|
||||||
|
|
||||||
|
lines, ok := sr.cache[filename]
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
data, err := ioutil.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
sr.cache[filename] = nil
|
||||||
|
return nil, 0
|
||||||
|
}
|
||||||
|
lines = bytes.Split(data, []byte{'\n'})
|
||||||
|
sr.cache[filename] = lines
|
||||||
|
}
|
||||||
|
|
||||||
|
return sr.calculateContextLines(lines, line, context)
|
||||||
|
}
|
||||||
|
|
||||||
|
// `contextLine` points to a line that caused an issue itself, in relation to returned slice
|
||||||
|
func (sr *sourceReader) calculateContextLines(lines [][]byte, line, context int) ([][]byte, int) {
|
||||||
|
// Stacktrace lines are 1-indexed, slices are 0-indexed
|
||||||
|
line--
|
||||||
|
|
||||||
|
contextLine := context
|
||||||
|
|
||||||
|
if lines == nil || line >= len(lines) || line < 0 {
|
||||||
|
return nil, 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if context < 0 {
|
||||||
|
context = 0
|
||||||
|
contextLine = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
start := line - context
|
||||||
|
|
||||||
|
if start < 0 {
|
||||||
|
contextLine += start
|
||||||
|
start = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
end := line + context + 1
|
||||||
|
|
||||||
|
if end > len(lines) {
|
||||||
|
end = len(lines)
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines[start:end], contextLine
|
||||||
|
}
|
283
vendor/github.com/getsentry/sentry-go/stacktrace.go
generated
vendored
Normal file
283
vendor/github.com/getsentry/sentry-go/stacktrace.go
generated
vendored
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/build"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
const unknown string = "unknown"
|
||||||
|
|
||||||
|
// The module download is split into two parts: downloading the go.mod and downloading the actual code.
|
||||||
|
// If you have dependencies only needed for tests, then they will show up in your go.mod,
|
||||||
|
// and go get will download their go.mods, but it will not download their code.
|
||||||
|
// The test-only dependencies get downloaded only when you need it, such as the first time you run go test.
|
||||||
|
//
|
||||||
|
// https://github.com/golang/go/issues/26913#issuecomment-411976222
|
||||||
|
|
||||||
|
// Stacktrace holds information about the frames of the stack.
|
||||||
|
type Stacktrace struct {
|
||||||
|
Frames []Frame `json:"frames,omitempty"`
|
||||||
|
FramesOmitted []uint `json:"frames_omitted,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewStacktrace creates a stacktrace using `runtime.Callers`.
|
||||||
|
func NewStacktrace() *Stacktrace {
|
||||||
|
pcs := make([]uintptr, 100)
|
||||||
|
n := runtime.Callers(1, pcs)
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
frames := extractFrames(pcs[:n])
|
||||||
|
frames = filterFrames(frames)
|
||||||
|
|
||||||
|
stacktrace := Stacktrace{
|
||||||
|
Frames: frames,
|
||||||
|
}
|
||||||
|
|
||||||
|
return &stacktrace
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExtractStacktrace creates a new `Stacktrace` based on the given `error` object.
|
||||||
|
// TODO: Make it configurable so that anyone can provide their own implementation?
|
||||||
|
// Use of reflection allows us to not have a hard dependency on any given package, so we don't have to import it
|
||||||
|
func ExtractStacktrace(err error) *Stacktrace {
|
||||||
|
method := extractReflectedStacktraceMethod(err)
|
||||||
|
|
||||||
|
if !method.IsValid() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
pcs := extractPcs(method)
|
||||||
|
|
||||||
|
if len(pcs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
frames := extractFrames(pcs)
|
||||||
|
frames = filterFrames(frames)
|
||||||
|
|
||||||
|
stacktrace := Stacktrace{
|
||||||
|
Frames: frames,
|
||||||
|
}
|
||||||
|
|
||||||
|
return &stacktrace
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractReflectedStacktraceMethod(err error) reflect.Value {
|
||||||
|
var method reflect.Value
|
||||||
|
|
||||||
|
// https://github.com/pingcap/errors
|
||||||
|
methodGetStackTracer := reflect.ValueOf(err).MethodByName("GetStackTracer")
|
||||||
|
// https://github.com/pkg/errors
|
||||||
|
methodStackTrace := reflect.ValueOf(err).MethodByName("StackTrace")
|
||||||
|
// https://github.com/go-errors/errors
|
||||||
|
methodStackFrames := reflect.ValueOf(err).MethodByName("StackFrames")
|
||||||
|
|
||||||
|
if methodGetStackTracer.IsValid() {
|
||||||
|
stacktracer := methodGetStackTracer.Call(make([]reflect.Value, 0))[0]
|
||||||
|
stacktracerStackTrace := reflect.ValueOf(stacktracer).MethodByName("StackTrace")
|
||||||
|
|
||||||
|
if stacktracerStackTrace.IsValid() {
|
||||||
|
method = stacktracerStackTrace
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if methodStackTrace.IsValid() {
|
||||||
|
method = methodStackTrace
|
||||||
|
}
|
||||||
|
|
||||||
|
if methodStackFrames.IsValid() {
|
||||||
|
method = methodStackFrames
|
||||||
|
}
|
||||||
|
|
||||||
|
return method
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractPcs(method reflect.Value) []uintptr {
|
||||||
|
var pcs []uintptr
|
||||||
|
|
||||||
|
stacktrace := method.Call(make([]reflect.Value, 0))[0]
|
||||||
|
|
||||||
|
if stacktrace.Kind() != reflect.Slice {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < stacktrace.Len(); i++ {
|
||||||
|
pc := stacktrace.Index(i)
|
||||||
|
|
||||||
|
if pc.Kind() == reflect.Uintptr {
|
||||||
|
pcs = append(pcs, uintptr(pc.Uint()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if pc.Kind() == reflect.Struct {
|
||||||
|
field := pc.FieldByName("ProgramCounter")
|
||||||
|
if field.IsValid() && field.Kind() == reflect.Uintptr {
|
||||||
|
pcs = append(pcs, uintptr(field.Uint()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pcs
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.sentry.io/development/sdk-dev/event-payloads/stacktrace/
|
||||||
|
type Frame struct {
|
||||||
|
Function string `json:"function,omitempty"`
|
||||||
|
Symbol string `json:"symbol,omitempty"`
|
||||||
|
Module string `json:"module,omitempty"`
|
||||||
|
Package string `json:"package,omitempty"`
|
||||||
|
Filename string `json:"filename,omitempty"`
|
||||||
|
AbsPath string `json:"abs_path,omitempty"`
|
||||||
|
Lineno int `json:"lineno,omitempty"`
|
||||||
|
Colno int `json:"colno,omitempty"`
|
||||||
|
PreContext []string `json:"pre_context,omitempty"`
|
||||||
|
ContextLine string `json:"context_line,omitempty"`
|
||||||
|
PostContext []string `json:"post_context,omitempty"`
|
||||||
|
InApp bool `json:"in_app,omitempty"`
|
||||||
|
Vars map[string]interface{} `json:"vars,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFrame assembles a stacktrace frame out of `runtime.Frame`.
|
||||||
|
func NewFrame(f runtime.Frame) Frame {
|
||||||
|
abspath := f.File
|
||||||
|
filename := f.File
|
||||||
|
function := f.Function
|
||||||
|
var pkg string
|
||||||
|
|
||||||
|
if filename != "" {
|
||||||
|
filename = filepath.Base(filename)
|
||||||
|
} else {
|
||||||
|
filename = unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
if abspath == "" {
|
||||||
|
abspath = unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
if function != "" {
|
||||||
|
pkg, function = splitQualifiedFunctionName(function)
|
||||||
|
}
|
||||||
|
|
||||||
|
frame := Frame{
|
||||||
|
AbsPath: abspath,
|
||||||
|
Filename: filename,
|
||||||
|
Lineno: f.Line,
|
||||||
|
Module: pkg,
|
||||||
|
Function: function,
|
||||||
|
}
|
||||||
|
|
||||||
|
frame.InApp = isInAppFrame(frame)
|
||||||
|
|
||||||
|
return frame
|
||||||
|
}
|
||||||
|
|
||||||
|
// splitQualifiedFunctionName splits a package path-qualified function name into
|
||||||
|
// package name and function name. Such qualified names are found in
|
||||||
|
// runtime.Frame.Function values.
|
||||||
|
func splitQualifiedFunctionName(name string) (pkg string, fun string) {
|
||||||
|
pkg = packageName(name)
|
||||||
|
fun = strings.TrimPrefix(name, pkg+".")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractFrames(pcs []uintptr) []Frame {
|
||||||
|
var frames []Frame
|
||||||
|
callersFrames := runtime.CallersFrames(pcs)
|
||||||
|
|
||||||
|
for {
|
||||||
|
callerFrame, more := callersFrames.Next()
|
||||||
|
|
||||||
|
frames = append([]Frame{
|
||||||
|
NewFrame(callerFrame),
|
||||||
|
}, frames...)
|
||||||
|
|
||||||
|
if !more {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return frames
|
||||||
|
}
|
||||||
|
|
||||||
|
// filterFrames filters out stack frames that are not meant to be reported to
|
||||||
|
// Sentry. Those are frames internal to the SDK or Go.
|
||||||
|
func filterFrames(frames []Frame) []Frame {
|
||||||
|
if len(frames) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
filteredFrames := make([]Frame, 0, len(frames))
|
||||||
|
|
||||||
|
for _, frame := range frames {
|
||||||
|
// Skip Go internal frames.
|
||||||
|
if frame.Module == "runtime" || frame.Module == "testing" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// Skip Sentry internal frames, except for frames in _test packages (for
|
||||||
|
// testing).
|
||||||
|
if strings.HasPrefix(frame.Module, "github.com/getsentry/sentry-go") &&
|
||||||
|
!strings.HasSuffix(frame.Module, "_test") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
filteredFrames = append(filteredFrames, frame)
|
||||||
|
}
|
||||||
|
|
||||||
|
return filteredFrames
|
||||||
|
}
|
||||||
|
|
||||||
|
func isInAppFrame(frame Frame) bool {
|
||||||
|
if strings.HasPrefix(frame.AbsPath, build.Default.GOROOT) ||
|
||||||
|
strings.Contains(frame.Module, "vendor") ||
|
||||||
|
strings.Contains(frame.Module, "third_party") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func callerFunctionName() string {
|
||||||
|
pcs := make([]uintptr, 1)
|
||||||
|
runtime.Callers(3, pcs)
|
||||||
|
callersFrames := runtime.CallersFrames(pcs)
|
||||||
|
callerFrame, _ := callersFrames.Next()
|
||||||
|
return baseName(callerFrame.Function)
|
||||||
|
}
|
||||||
|
|
||||||
|
// packageName returns the package part of the symbol name, or the empty string
|
||||||
|
// if there is none.
|
||||||
|
// It replicates https://golang.org/pkg/debug/gosym/#Sym.PackageName, avoiding a
|
||||||
|
// dependency on debug/gosym.
|
||||||
|
func packageName(name string) string {
|
||||||
|
// A prefix of "type." and "go." is a compiler-generated symbol that doesn't belong to any package.
|
||||||
|
// See variable reservedimports in cmd/compile/internal/gc/subr.go
|
||||||
|
if strings.HasPrefix(name, "go.") || strings.HasPrefix(name, "type.") {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
pathend := strings.LastIndex(name, "/")
|
||||||
|
if pathend < 0 {
|
||||||
|
pathend = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if i := strings.Index(name[pathend:], "."); i != -1 {
|
||||||
|
return name[:pathend+i]
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// baseName returns the symbol name without the package or receiver name.
|
||||||
|
// It replicates https://golang.org/pkg/debug/gosym/#Sym.BaseName, avoiding a
|
||||||
|
// dependency on debug/gosym.
|
||||||
|
func baseName(name string) string {
|
||||||
|
if i := strings.LastIndex(name, "."); i != -1 {
|
||||||
|
return name[i+1:]
|
||||||
|
}
|
||||||
|
return name
|
||||||
|
}
|
447
vendor/github.com/getsentry/sentry-go/transport.go
generated
vendored
Normal file
447
vendor/github.com/getsentry/sentry-go/transport.go
generated
vendored
Normal file
|
@ -0,0 +1,447 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"crypto/tls"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const defaultBufferSize = 30
|
||||||
|
const defaultRetryAfter = time.Second * 60
|
||||||
|
const defaultTimeout = time.Second * 30
|
||||||
|
|
||||||
|
// Transport is used by the `Client` to deliver events to remote server.
|
||||||
|
type Transport interface {
|
||||||
|
Flush(timeout time.Duration) bool
|
||||||
|
Configure(options ClientOptions)
|
||||||
|
SendEvent(event *Event)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getProxyConfig(options ClientOptions) func(*http.Request) (*url.URL, error) {
|
||||||
|
if options.HTTPSProxy != "" {
|
||||||
|
return func(_ *http.Request) (*url.URL, error) {
|
||||||
|
return url.Parse(options.HTTPSProxy)
|
||||||
|
}
|
||||||
|
} else if options.HTTPProxy != "" {
|
||||||
|
return func(_ *http.Request) (*url.URL, error) {
|
||||||
|
return url.Parse(options.HTTPProxy)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return http.ProxyFromEnvironment
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTLSConfig(options ClientOptions) *tls.Config {
|
||||||
|
if options.CaCerts != nil {
|
||||||
|
return &tls.Config{
|
||||||
|
RootCAs: options.CaCerts,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func retryAfter(now time.Time, r *http.Response) time.Duration {
|
||||||
|
retryAfterHeader := r.Header["Retry-After"]
|
||||||
|
|
||||||
|
if retryAfterHeader == nil {
|
||||||
|
return defaultRetryAfter
|
||||||
|
}
|
||||||
|
|
||||||
|
if date, err := time.Parse(time.RFC1123, retryAfterHeader[0]); err == nil {
|
||||||
|
return date.Sub(now)
|
||||||
|
}
|
||||||
|
|
||||||
|
if seconds, err := strconv.Atoi(retryAfterHeader[0]); err == nil {
|
||||||
|
return time.Second * time.Duration(seconds)
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultRetryAfter
|
||||||
|
}
|
||||||
|
|
||||||
|
func getRequestBodyFromEvent(event *Event) []byte {
|
||||||
|
body, err := json.Marshal(event)
|
||||||
|
if err == nil {
|
||||||
|
return body
|
||||||
|
}
|
||||||
|
|
||||||
|
partialMarshallMessage := "Original event couldn't be marshalled. Succeeded by stripping the data " +
|
||||||
|
"that uses interface{} type. Please verify that the data you attach to the scope is serializable."
|
||||||
|
// Try to serialize the event, with all the contextual data that allows for interface{} stripped.
|
||||||
|
event.Breadcrumbs = nil
|
||||||
|
event.Contexts = nil
|
||||||
|
event.Extra = map[string]interface{}{
|
||||||
|
"info": partialMarshallMessage,
|
||||||
|
}
|
||||||
|
body, err = json.Marshal(event)
|
||||||
|
if err == nil {
|
||||||
|
Logger.Println(partialMarshallMessage)
|
||||||
|
return body
|
||||||
|
}
|
||||||
|
|
||||||
|
// This should _only_ happen when Event.Exception[0].Stacktrace.Frames[0].Vars is unserializable
|
||||||
|
// Which won't ever happen, as we don't use it now (although it's the part of public interface accepted by Sentry)
|
||||||
|
// Juuust in case something, somehow goes utterly wrong.
|
||||||
|
Logger.Println("Event couldn't be marshalled, even with stripped contextual data. Skipping delivery. " +
|
||||||
|
"Please notify the SDK owners with possibly broken payload.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================
|
||||||
|
// HTTPTransport
|
||||||
|
// ================================
|
||||||
|
|
||||||
|
// A batch groups items that are processed sequentially.
|
||||||
|
type batch struct {
|
||||||
|
items chan *http.Request
|
||||||
|
started chan struct{} // closed to signal items started to be worked on
|
||||||
|
done chan struct{} // closed to signal completion of all items
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPTransport is a default implementation of `Transport` interface used by `Client`.
|
||||||
|
type HTTPTransport struct {
|
||||||
|
dsn *Dsn
|
||||||
|
client *http.Client
|
||||||
|
transport http.RoundTripper
|
||||||
|
|
||||||
|
// buffer is a channel of batches. Calling Flush terminates work on the
|
||||||
|
// current in-flight items and starts a new batch for subsequent events.
|
||||||
|
buffer chan batch
|
||||||
|
|
||||||
|
start sync.Once
|
||||||
|
|
||||||
|
// Size of the transport buffer. Defaults to 30.
|
||||||
|
BufferSize int
|
||||||
|
// HTTP Client request timeout. Defaults to 30 seconds.
|
||||||
|
Timeout time.Duration
|
||||||
|
|
||||||
|
mu sync.RWMutex
|
||||||
|
disabledUntil time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHTTPTransport returns a new pre-configured instance of HTTPTransport
|
||||||
|
func NewHTTPTransport() *HTTPTransport {
|
||||||
|
transport := HTTPTransport{
|
||||||
|
BufferSize: defaultBufferSize,
|
||||||
|
Timeout: defaultTimeout,
|
||||||
|
}
|
||||||
|
return &transport
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure is called by the `Client` itself, providing it it's own `ClientOptions`.
|
||||||
|
func (t *HTTPTransport) Configure(options ClientOptions) {
|
||||||
|
dsn, err := NewDsn(options.Dsn)
|
||||||
|
if err != nil {
|
||||||
|
Logger.Printf("%v\n", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.dsn = dsn
|
||||||
|
|
||||||
|
// A buffered channel with capacity 1 works like a mutex, ensuring only one
|
||||||
|
// goroutine can access the current batch at a given time. Access is
|
||||||
|
// synchronized by reading from and writing to the channel.
|
||||||
|
t.buffer = make(chan batch, 1)
|
||||||
|
t.buffer <- batch{
|
||||||
|
items: make(chan *http.Request, t.BufferSize),
|
||||||
|
started: make(chan struct{}),
|
||||||
|
done: make(chan struct{}),
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.HTTPTransport != nil {
|
||||||
|
t.transport = options.HTTPTransport
|
||||||
|
} else {
|
||||||
|
t.transport = &http.Transport{
|
||||||
|
Proxy: getProxyConfig(options),
|
||||||
|
TLSClientConfig: getTLSConfig(options),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.HTTPClient != nil {
|
||||||
|
t.client = options.HTTPClient
|
||||||
|
} else {
|
||||||
|
t.client = &http.Client{
|
||||||
|
Transport: t.transport,
|
||||||
|
Timeout: t.Timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t.start.Do(func() {
|
||||||
|
go t.worker()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// SendEvent assembles a new packet out of `Event` and sends it to remote server.
|
||||||
|
func (t *HTTPTransport) SendEvent(event *Event) {
|
||||||
|
if t.dsn == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.mu.RLock()
|
||||||
|
disabled := time.Now().Before(t.disabledUntil)
|
||||||
|
t.mu.RUnlock()
|
||||||
|
if disabled {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
body := getRequestBodyFromEvent(event)
|
||||||
|
if body == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
request, _ := http.NewRequest(
|
||||||
|
http.MethodPost,
|
||||||
|
t.dsn.StoreAPIURL().String(),
|
||||||
|
bytes.NewBuffer(body),
|
||||||
|
)
|
||||||
|
|
||||||
|
for headerKey, headerValue := range t.dsn.RequestHeaders() {
|
||||||
|
request.Header.Set(headerKey, headerValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
// <-t.buffer is equivalent to acquiring a lock to access the current batch.
|
||||||
|
// A few lines below, t.buffer <- b releases the lock.
|
||||||
|
//
|
||||||
|
// The lock must be held during the select block below to guarantee that
|
||||||
|
// b.items is not closed while trying to send to it. Remember that sending
|
||||||
|
// on a closed channel panics.
|
||||||
|
//
|
||||||
|
// Note that the select block takes a bounded amount of CPU time because of
|
||||||
|
// the default case that is executed if sending on b.items would block. That
|
||||||
|
// is, the event is dropped if it cannot be sent immediately to the b.items
|
||||||
|
// channel (used as a queue).
|
||||||
|
b := <-t.buffer
|
||||||
|
|
||||||
|
select {
|
||||||
|
case b.items <- request:
|
||||||
|
Logger.Printf(
|
||||||
|
"Sending %s event [%s] to %s project: %d\n",
|
||||||
|
event.Level,
|
||||||
|
event.EventID,
|
||||||
|
t.dsn.host,
|
||||||
|
t.dsn.projectID,
|
||||||
|
)
|
||||||
|
default:
|
||||||
|
Logger.Println("Event dropped due to transport buffer being full.")
|
||||||
|
}
|
||||||
|
|
||||||
|
t.buffer <- b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush waits until any buffered events are sent to the Sentry server, blocking
|
||||||
|
// for at most the given timeout. It returns false if the timeout was reached.
|
||||||
|
// In that case, some events may not have been sent.
|
||||||
|
//
|
||||||
|
// Flush should be called before terminating the program to avoid
|
||||||
|
// unintentionally dropping events.
|
||||||
|
//
|
||||||
|
// Do not call Flush indiscriminately after every call to SendEvent. Instead, to
|
||||||
|
// have the SDK send events over the network synchronously, configure it to use
|
||||||
|
// the HTTPSyncTransport in the call to Init.
|
||||||
|
func (t *HTTPTransport) Flush(timeout time.Duration) bool {
|
||||||
|
toolate := time.After(timeout)
|
||||||
|
|
||||||
|
// Wait until processing the current batch has started or the timeout.
|
||||||
|
//
|
||||||
|
// We must wait until the worker has seen the current batch, because it is
|
||||||
|
// the only way b.done will be closed. If we do not wait, there is a
|
||||||
|
// possible execution flow in which b.done is never closed, and the only way
|
||||||
|
// out of Flush would be waiting for the timeout, which is undesired.
|
||||||
|
var b batch
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case b = <-t.buffer:
|
||||||
|
select {
|
||||||
|
case <-b.started:
|
||||||
|
goto started
|
||||||
|
default:
|
||||||
|
t.buffer <- b
|
||||||
|
}
|
||||||
|
case <-toolate:
|
||||||
|
goto fail
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
started:
|
||||||
|
// Signal that there won't be any more items in this batch, so that the
|
||||||
|
// worker inner loop can end.
|
||||||
|
close(b.items)
|
||||||
|
// Start a new batch for subsequent events.
|
||||||
|
t.buffer <- batch{
|
||||||
|
items: make(chan *http.Request, t.BufferSize),
|
||||||
|
started: make(chan struct{}),
|
||||||
|
done: make(chan struct{}),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait until the current batch is done or the timeout.
|
||||||
|
select {
|
||||||
|
case <-b.done:
|
||||||
|
Logger.Println("Buffer flushed successfully.")
|
||||||
|
return true
|
||||||
|
case <-toolate:
|
||||||
|
goto fail
|
||||||
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
Logger.Println("Buffer flushing reached the timeout.")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *HTTPTransport) worker() {
|
||||||
|
for b := range t.buffer {
|
||||||
|
// Signal that processing of the current batch has started.
|
||||||
|
close(b.started)
|
||||||
|
|
||||||
|
// Return the batch to the buffer so that other goroutines can use it.
|
||||||
|
// Equivalent to releasing a lock.
|
||||||
|
t.buffer <- b
|
||||||
|
|
||||||
|
// Process all batch items.
|
||||||
|
for request := range b.items {
|
||||||
|
t.mu.RLock()
|
||||||
|
disabled := time.Now().Before(t.disabledUntil)
|
||||||
|
t.mu.RUnlock()
|
||||||
|
if disabled {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := t.client.Do(request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
Logger.Printf("There was an issue with sending an event: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if response != nil && response.StatusCode == http.StatusTooManyRequests {
|
||||||
|
deadline := time.Now().Add(retryAfter(time.Now(), response))
|
||||||
|
t.mu.Lock()
|
||||||
|
t.disabledUntil = deadline
|
||||||
|
t.mu.Unlock()
|
||||||
|
Logger.Printf("Too many requests, backing off till: %s\n", deadline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal that processing of the batch is done.
|
||||||
|
close(b.done)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================
|
||||||
|
// HTTPSyncTransport
|
||||||
|
// ================================
|
||||||
|
|
||||||
|
// HTTPSyncTransport is an implementation of `Transport` interface which blocks after each captured event.
|
||||||
|
type HTTPSyncTransport struct {
|
||||||
|
dsn *Dsn
|
||||||
|
client *http.Client
|
||||||
|
transport http.RoundTripper
|
||||||
|
disabledUntil time.Time
|
||||||
|
|
||||||
|
// HTTP Client request timeout. Defaults to 30 seconds.
|
||||||
|
Timeout time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHTTPSyncTransport returns a new pre-configured instance of HTTPSyncTransport
|
||||||
|
func NewHTTPSyncTransport() *HTTPSyncTransport {
|
||||||
|
transport := HTTPSyncTransport{
|
||||||
|
Timeout: defaultTimeout,
|
||||||
|
}
|
||||||
|
|
||||||
|
return &transport
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure is called by the `Client` itself, providing it it's own `ClientOptions`.
|
||||||
|
func (t *HTTPSyncTransport) Configure(options ClientOptions) {
|
||||||
|
dsn, err := NewDsn(options.Dsn)
|
||||||
|
if err != nil {
|
||||||
|
Logger.Printf("%v\n", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.dsn = dsn
|
||||||
|
|
||||||
|
if options.HTTPTransport != nil {
|
||||||
|
t.transport = options.HTTPTransport
|
||||||
|
} else {
|
||||||
|
t.transport = &http.Transport{
|
||||||
|
Proxy: getProxyConfig(options),
|
||||||
|
TLSClientConfig: getTLSConfig(options),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.HTTPClient != nil {
|
||||||
|
t.client = options.HTTPClient
|
||||||
|
} else {
|
||||||
|
t.client = &http.Client{
|
||||||
|
Transport: t.transport,
|
||||||
|
Timeout: t.Timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SendEvent assembles a new packet out of `Event` and sends it to remote server.
|
||||||
|
func (t *HTTPSyncTransport) SendEvent(event *Event) {
|
||||||
|
if t.dsn == nil || time.Now().Before(t.disabledUntil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
body := getRequestBodyFromEvent(event)
|
||||||
|
if body == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
request, _ := http.NewRequest(
|
||||||
|
http.MethodPost,
|
||||||
|
t.dsn.StoreAPIURL().String(),
|
||||||
|
bytes.NewBuffer(body),
|
||||||
|
)
|
||||||
|
|
||||||
|
for headerKey, headerValue := range t.dsn.RequestHeaders() {
|
||||||
|
request.Header.Set(headerKey, headerValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.Printf(
|
||||||
|
"Sending %s event [%s] to %s project: %d\n",
|
||||||
|
event.Level,
|
||||||
|
event.EventID,
|
||||||
|
t.dsn.host,
|
||||||
|
t.dsn.projectID,
|
||||||
|
)
|
||||||
|
|
||||||
|
response, err := t.client.Do(request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
Logger.Printf("There was an issue with sending an event: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if response != nil && response.StatusCode == http.StatusTooManyRequests {
|
||||||
|
t.disabledUntil = time.Now().Add(retryAfter(time.Now(), response))
|
||||||
|
Logger.Printf("Too many requests, backing off till: %s\n", t.disabledUntil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush is a no-op for HTTPSyncTransport. It always returns true immediately.
|
||||||
|
func (t *HTTPSyncTransport) Flush(_ time.Duration) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================
|
||||||
|
// noopTransport
|
||||||
|
// ================================
|
||||||
|
|
||||||
|
// noopTransport is an implementation of `Transport` interface which drops all the events.
|
||||||
|
// Only used internally when an empty DSN is provided, which effectively disables the SDK.
|
||||||
|
type noopTransport struct{}
|
||||||
|
|
||||||
|
func (t *noopTransport) Configure(options ClientOptions) {
|
||||||
|
Logger.Println("Sentry client initialized with an empty DSN. Using noopTransport. No events will be delivered.")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *noopTransport) SendEvent(event *Event) {
|
||||||
|
Logger.Println("Event dropped due to noopTransport usage.")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *noopTransport) Flush(_ time.Duration) bool {
|
||||||
|
return true
|
||||||
|
}
|
34
vendor/github.com/getsentry/sentry-go/util.go
generated
vendored
Normal file
34
vendor/github.com/getsentry/sentry-go/util.go
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
package sentry
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func uuid() string {
|
||||||
|
id := make([]byte, 16)
|
||||||
|
_, _ = io.ReadFull(rand.Reader, id)
|
||||||
|
id[6] &= 0x0F // clear version
|
||||||
|
id[6] |= 0x40 // set version to 4 (random uuid)
|
||||||
|
id[8] &= 0x3F // clear variant
|
||||||
|
id[8] |= 0x80 // set to IETF variant
|
||||||
|
return hex.EncodeToString(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func fileExists(fileName string) bool {
|
||||||
|
if _, err := os.Stat(fileName); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
//nolint: deadcode, unused
|
||||||
|
func prettyPrint(data interface{}) {
|
||||||
|
dbg, _ := json.MarshalIndent(data, "", " ")
|
||||||
|
fmt.Println(string(dbg))
|
||||||
|
}
|
164
vendor/github.com/urfave/cli/build.go
generated
vendored
164
vendor/github.com/urfave/cli/build.go
generated
vendored
|
@ -1,164 +0,0 @@
|
||||||
//+build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
|
||||||
)
|
|
||||||
|
|
||||||
var packages = []string{"cli", "altsrc"}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
app := cli.NewApp()
|
|
||||||
|
|
||||||
app.Name = "builder"
|
|
||||||
app.Usage = "Generates a new urfave/cli build!"
|
|
||||||
|
|
||||||
app.Commands = cli.Commands{
|
|
||||||
cli.Command{
|
|
||||||
Name: "vet",
|
|
||||||
Action: VetActionFunc,
|
|
||||||
},
|
|
||||||
cli.Command{
|
|
||||||
Name: "test",
|
|
||||||
Action: TestActionFunc,
|
|
||||||
},
|
|
||||||
cli.Command{
|
|
||||||
Name: "gfmrun",
|
|
||||||
Action: GfmrunActionFunc,
|
|
||||||
},
|
|
||||||
cli.Command{
|
|
||||||
Name: "toc",
|
|
||||||
Action: TocActionFunc,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
err := app.Run(os.Args)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func runCmd(arg string, args ...string) error {
|
|
||||||
cmd := exec.Command(arg, args...)
|
|
||||||
|
|
||||||
cmd.Stdin = os.Stdin
|
|
||||||
cmd.Stdout = os.Stdout
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
|
|
||||||
return cmd.Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
func VetActionFunc(_ *cli.Context) error {
|
|
||||||
return runCmd("go", "vet")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestActionFunc(c *cli.Context) error {
|
|
||||||
for _, pkg := range packages {
|
|
||||||
var packageName string
|
|
||||||
|
|
||||||
if pkg == "cli" {
|
|
||||||
packageName = "github.com/urfave/cli"
|
|
||||||
} else {
|
|
||||||
packageName = fmt.Sprintf("github.com/urfave/cli/%s", pkg)
|
|
||||||
}
|
|
||||||
|
|
||||||
coverProfile := fmt.Sprintf("--coverprofile=%s.coverprofile", pkg)
|
|
||||||
|
|
||||||
err := runCmd("go", "test", "-v", coverProfile, packageName)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return testCleanup()
|
|
||||||
}
|
|
||||||
|
|
||||||
func testCleanup() error {
|
|
||||||
var out bytes.Buffer
|
|
||||||
|
|
||||||
for _, pkg := range packages {
|
|
||||||
file, err := os.Open(fmt.Sprintf("%s.coverprofile", pkg))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err := ioutil.ReadAll(file)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
out.Write(b)
|
|
||||||
err = file.Close()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = os.Remove(fmt.Sprintf("%s.coverprofile", pkg))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
outFile, err := os.Create("coverage.txt")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = out.WriteTo(outFile)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = outFile.Close()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GfmrunActionFunc(_ *cli.Context) error {
|
|
||||||
file, err := os.Open("README.md")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
var counter int
|
|
||||||
scanner := bufio.NewScanner(file)
|
|
||||||
for scanner.Scan() {
|
|
||||||
if strings.Contains(scanner.Text(), "package main") {
|
|
||||||
counter++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = scanner.Err()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return runCmd("gfmrun", "-c", fmt.Sprint(counter), "-s", "README.md")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TocActionFunc(_ *cli.Context) error {
|
|
||||||
err := runCmd("node_modules/.bin/markdown-toc", "-i", "README.md")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = runCmd("git", "diff", "--exit-code")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
48
vendor/golang.org/x/net/http2/server.go
generated
vendored
48
vendor/golang.org/x/net/http2/server.go
generated
vendored
|
@ -52,10 +52,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
prefaceTimeout = 10 * time.Second
|
prefaceTimeout = 10 * time.Second
|
||||||
firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway
|
firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway
|
||||||
handlerChunkWriteSize = 4 << 10
|
handlerChunkWriteSize = 4 << 10
|
||||||
defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to?
|
defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to?
|
||||||
|
maxQueuedControlFrames = 10000
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -163,6 +164,15 @@ func (s *Server) maxConcurrentStreams() uint32 {
|
||||||
return defaultMaxStreams
|
return defaultMaxStreams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maxQueuedControlFrames is the maximum number of control frames like
|
||||||
|
// SETTINGS, PING and RST_STREAM that will be queued for writing before
|
||||||
|
// the connection is closed to prevent memory exhaustion attacks.
|
||||||
|
func (s *Server) maxQueuedControlFrames() int {
|
||||||
|
// TODO: if anybody asks, add a Server field, and remember to define the
|
||||||
|
// behavior of negative values.
|
||||||
|
return maxQueuedControlFrames
|
||||||
|
}
|
||||||
|
|
||||||
type serverInternalState struct {
|
type serverInternalState struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
activeConns map[*serverConn]struct{}
|
activeConns map[*serverConn]struct{}
|
||||||
|
@ -312,7 +322,7 @@ type ServeConnOpts struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ServeConnOpts) context() context.Context {
|
func (o *ServeConnOpts) context() context.Context {
|
||||||
if o.Context != nil {
|
if o != nil && o.Context != nil {
|
||||||
return o.Context
|
return o.Context
|
||||||
}
|
}
|
||||||
return context.Background()
|
return context.Background()
|
||||||
|
@ -506,6 +516,7 @@ type serverConn struct {
|
||||||
sawFirstSettings bool // got the initial SETTINGS frame after the preface
|
sawFirstSettings bool // got the initial SETTINGS frame after the preface
|
||||||
needToSendSettingsAck bool
|
needToSendSettingsAck bool
|
||||||
unackedSettings int // how many SETTINGS have we sent without ACKs?
|
unackedSettings int // how many SETTINGS have we sent without ACKs?
|
||||||
|
queuedControlFrames int // control frames in the writeSched queue
|
||||||
clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit)
|
clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit)
|
||||||
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
|
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
|
||||||
curClientStreams uint32 // number of open streams initiated by the client
|
curClientStreams uint32 // number of open streams initiated by the client
|
||||||
|
@ -894,6 +905,14 @@ func (sc *serverConn) serve() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the peer is causing us to generate a lot of control frames,
|
||||||
|
// but not reading them from us, assume they are trying to make us
|
||||||
|
// run out of memory.
|
||||||
|
if sc.queuedControlFrames > sc.srv.maxQueuedControlFrames() {
|
||||||
|
sc.vlogf("http2: too many control frames in send queue, closing connection")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Start the shutdown timer after sending a GOAWAY. When sending GOAWAY
|
// Start the shutdown timer after sending a GOAWAY. When sending GOAWAY
|
||||||
// with no error code (graceful shutdown), don't start the timer until
|
// with no error code (graceful shutdown), don't start the timer until
|
||||||
// all open streams have been completed.
|
// all open streams have been completed.
|
||||||
|
@ -1093,6 +1112,14 @@ func (sc *serverConn) writeFrame(wr FrameWriteRequest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ignoreWrite {
|
if !ignoreWrite {
|
||||||
|
if wr.isControl() {
|
||||||
|
sc.queuedControlFrames++
|
||||||
|
// For extra safety, detect wraparounds, which should not happen,
|
||||||
|
// and pull the plug.
|
||||||
|
if sc.queuedControlFrames < 0 {
|
||||||
|
sc.conn.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
sc.writeSched.Push(wr)
|
sc.writeSched.Push(wr)
|
||||||
}
|
}
|
||||||
sc.scheduleFrameWrite()
|
sc.scheduleFrameWrite()
|
||||||
|
@ -1210,10 +1237,8 @@ func (sc *serverConn) wroteFrame(res frameWriteResult) {
|
||||||
// If a frame is already being written, nothing happens. This will be called again
|
// If a frame is already being written, nothing happens. This will be called again
|
||||||
// when the frame is done being written.
|
// when the frame is done being written.
|
||||||
//
|
//
|
||||||
// If a frame isn't being written we need to send one, the best frame
|
// If a frame isn't being written and we need to send one, the best frame
|
||||||
// to send is selected, preferring first things that aren't
|
// to send is selected by writeSched.
|
||||||
// stream-specific (e.g. ACKing settings), and then finding the
|
|
||||||
// highest priority stream.
|
|
||||||
//
|
//
|
||||||
// If a frame isn't being written and there's nothing else to send, we
|
// If a frame isn't being written and there's nothing else to send, we
|
||||||
// flush the write buffer.
|
// flush the write buffer.
|
||||||
|
@ -1241,6 +1266,9 @@ func (sc *serverConn) scheduleFrameWrite() {
|
||||||
}
|
}
|
||||||
if !sc.inGoAway || sc.goAwayCode == ErrCodeNo {
|
if !sc.inGoAway || sc.goAwayCode == ErrCodeNo {
|
||||||
if wr, ok := sc.writeSched.Pop(); ok {
|
if wr, ok := sc.writeSched.Pop(); ok {
|
||||||
|
if wr.isControl() {
|
||||||
|
sc.queuedControlFrames--
|
||||||
|
}
|
||||||
sc.startFrameWrite(wr)
|
sc.startFrameWrite(wr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -1533,6 +1561,8 @@ func (sc *serverConn) processSettings(f *SettingsFrame) error {
|
||||||
if err := f.ForeachSetting(sc.processSetting); err != nil {
|
if err := f.ForeachSetting(sc.processSetting); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// TODO: judging by RFC 7540, Section 6.5.3 each SETTINGS frame should be
|
||||||
|
// acknowledged individually, even if multiple are received before the ACK.
|
||||||
sc.needToSendSettingsAck = true
|
sc.needToSendSettingsAck = true
|
||||||
sc.scheduleFrameWrite()
|
sc.scheduleFrameWrite()
|
||||||
return nil
|
return nil
|
||||||
|
|
2
vendor/golang.org/x/net/http2/transport.go
generated
vendored
2
vendor/golang.org/x/net/http2/transport.go
generated
vendored
|
@ -992,7 +992,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf
|
||||||
req.Method != "HEAD" {
|
req.Method != "HEAD" {
|
||||||
// Request gzip only, not deflate. Deflate is ambiguous and
|
// Request gzip only, not deflate. Deflate is ambiguous and
|
||||||
// not as universally supported anyway.
|
// not as universally supported anyway.
|
||||||
// See: http://www.gzip.org/zlib/zlib_faq.html#faq38
|
// See: https://zlib.net/zlib_faq.html#faq39
|
||||||
//
|
//
|
||||||
// Note that we don't request this for HEAD requests,
|
// Note that we don't request this for HEAD requests,
|
||||||
// due to a bug in nginx:
|
// due to a bug in nginx:
|
||||||
|
|
8
vendor/golang.org/x/net/http2/writesched.go
generated
vendored
8
vendor/golang.org/x/net/http2/writesched.go
generated
vendored
|
@ -32,7 +32,7 @@ type WriteScheduler interface {
|
||||||
|
|
||||||
// Pop dequeues the next frame to write. Returns false if no frames can
|
// Pop dequeues the next frame to write. Returns false if no frames can
|
||||||
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
||||||
// order they are Push'd.
|
// order they are Push'd. No frames should be discarded except by CloseStream.
|
||||||
Pop() (wr FrameWriteRequest, ok bool)
|
Pop() (wr FrameWriteRequest, ok bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,12 @@ func (wr FrameWriteRequest) StreamID() uint32 {
|
||||||
return wr.stream.id
|
return wr.stream.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isControl reports whether wr is a control frame for MaxQueuedControlFrames
|
||||||
|
// purposes. That includes non-stream frames and RST_STREAM frames.
|
||||||
|
func (wr FrameWriteRequest) isControl() bool {
|
||||||
|
return wr.stream == nil
|
||||||
|
}
|
||||||
|
|
||||||
// DataSize returns the number of flow control bytes that must be consumed
|
// DataSize returns the number of flow control bytes that must be consumed
|
||||||
// to write this entire frame. This is 0 for non-DATA frames.
|
// to write this entire frame. This is 0 for non-DATA frames.
|
||||||
func (wr FrameWriteRequest) DataSize() int {
|
func (wr FrameWriteRequest) DataSize() int {
|
||||||
|
|
61
vendor/golang.org/x/sys/unix/mkasm_darwin.go
generated
vendored
61
vendor/golang.org/x/sys/unix/mkasm_darwin.go
generated
vendored
|
@ -1,61 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
|
|
||||||
//This program must be run after mksyscall.go.
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
in1, err := ioutil.ReadFile("syscall_darwin.go")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("can't open syscall_darwin.go: %s", err)
|
|
||||||
}
|
|
||||||
arch := os.Args[1]
|
|
||||||
in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err)
|
|
||||||
}
|
|
||||||
in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err)
|
|
||||||
}
|
|
||||||
in := string(in1) + string(in2) + string(in3)
|
|
||||||
|
|
||||||
trampolines := map[string]bool{}
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
|
||||||
|
|
||||||
fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
|
|
||||||
fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
|
|
||||||
fmt.Fprintf(&out, "\n")
|
|
||||||
fmt.Fprintf(&out, "// +build go1.12\n")
|
|
||||||
fmt.Fprintf(&out, "\n")
|
|
||||||
fmt.Fprintf(&out, "#include \"textflag.h\"\n")
|
|
||||||
for _, line := range strings.Split(in, "\n") {
|
|
||||||
if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fn := line[5 : len(line)-13]
|
|
||||||
if !trampolines[fn] {
|
|
||||||
trampolines[fn] = true
|
|
||||||
fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
|
|
||||||
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err)
|
|
||||||
}
|
|
||||||
}
|
|
122
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
122
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
|
@ -1,122 +0,0 @@
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
// mkpost processes the output of cgo -godefs to
|
|
||||||
// modify the generated types. It is used to clean up
|
|
||||||
// the sys API in an architecture specific manner.
|
|
||||||
//
|
|
||||||
// mkpost is run after cgo -godefs; see README.md.
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"go/format"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Get the OS and architecture (using GOARCH_TARGET if it exists)
|
|
||||||
goos := os.Getenv("GOOS")
|
|
||||||
goarch := os.Getenv("GOARCH_TARGET")
|
|
||||||
if goarch == "" {
|
|
||||||
goarch = os.Getenv("GOARCH")
|
|
||||||
}
|
|
||||||
// Check that we are using the Docker-based build system if we should be.
|
|
||||||
if goos == "linux" {
|
|
||||||
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
|
|
||||||
os.Stderr.WriteString("In the Docker-based build system, mkpost should not be called directly.\n")
|
|
||||||
os.Stderr.WriteString("See README.md\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err := ioutil.ReadAll(os.Stdin)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if goos == "aix" {
|
|
||||||
// Replace type of Atim, Mtim and Ctim by Timespec in Stat_t
|
|
||||||
// to avoid having both StTimespec and Timespec.
|
|
||||||
sttimespec := regexp.MustCompile(`_Ctype_struct_st_timespec`)
|
|
||||||
b = sttimespec.ReplaceAll(b, []byte("Timespec"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Intentionally export __val fields in Fsid and Sigset_t
|
|
||||||
valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__(bits|val)(\s+\S+\s+)}`)
|
|
||||||
b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$4}"))
|
|
||||||
|
|
||||||
// Intentionally export __fds_bits field in FdSet
|
|
||||||
fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`)
|
|
||||||
b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}"))
|
|
||||||
|
|
||||||
// If we have empty Ptrace structs, we should delete them. Only s390x emits
|
|
||||||
// nonempty Ptrace structs.
|
|
||||||
ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
|
|
||||||
b = ptraceRexexp.ReplaceAll(b, nil)
|
|
||||||
|
|
||||||
// Replace the control_regs union with a blank identifier for now.
|
|
||||||
controlRegsRegex := regexp.MustCompile(`(Control_regs)\s+\[0\]uint64`)
|
|
||||||
b = controlRegsRegex.ReplaceAll(b, []byte("_ [0]uint64"))
|
|
||||||
|
|
||||||
// Remove fields that are added by glibc
|
|
||||||
// Note that this is unstable as the identifers are private.
|
|
||||||
removeFieldsRegex := regexp.MustCompile(`X__glibc\S*`)
|
|
||||||
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
|
|
||||||
|
|
||||||
// Convert [65]int8 to [65]byte in Utsname members to simplify
|
|
||||||
// conversion to string; see golang.org/issue/20753
|
|
||||||
convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`)
|
|
||||||
b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
|
|
||||||
|
|
||||||
// Convert [1024]int8 to [1024]byte in Ptmget members
|
|
||||||
convertPtmget := regexp.MustCompile(`([SC]n)(\s+)\[(\d+)\]u?int8`)
|
|
||||||
b = convertPtmget.ReplaceAll(b, []byte("$1[$3]byte"))
|
|
||||||
|
|
||||||
// Remove spare fields (e.g. in Statx_t)
|
|
||||||
spareFieldsRegex := regexp.MustCompile(`X__spare\S*`)
|
|
||||||
b = spareFieldsRegex.ReplaceAll(b, []byte("_"))
|
|
||||||
|
|
||||||
// Remove cgo padding fields
|
|
||||||
removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
|
|
||||||
b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_"))
|
|
||||||
|
|
||||||
// Remove padding, hidden, or unused fields
|
|
||||||
removeFieldsRegex = regexp.MustCompile(`\b(X_\S+|Padding)`)
|
|
||||||
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
|
|
||||||
|
|
||||||
// Remove the first line of warning from cgo
|
|
||||||
b = b[bytes.IndexByte(b, '\n')+1:]
|
|
||||||
// Modify the command in the header to include:
|
|
||||||
// mkpost, our own warning, and a build tag.
|
|
||||||
replacement := fmt.Sprintf(`$1 | go run mkpost.go
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s,%s`, goarch, goos)
|
|
||||||
cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
|
|
||||||
b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
|
|
||||||
|
|
||||||
// Rename Stat_t time fields
|
|
||||||
if goos == "freebsd" && goarch == "386" {
|
|
||||||
// Hide Stat_t.[AMCB]tim_ext fields
|
|
||||||
renameStatTimeExtFieldsRegex := regexp.MustCompile(`[AMCB]tim_ext`)
|
|
||||||
b = renameStatTimeExtFieldsRegex.ReplaceAll(b, []byte("_"))
|
|
||||||
}
|
|
||||||
renameStatTimeFieldsRegex := regexp.MustCompile(`([AMCB])(?:irth)?time?(?:spec)?\s+(Timespec|StTimespec)`)
|
|
||||||
b = renameStatTimeFieldsRegex.ReplaceAll(b, []byte("${1}tim ${2}"))
|
|
||||||
|
|
||||||
// gofmt
|
|
||||||
b, err = format.Source(b)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Stdout.Write(b)
|
|
||||||
}
|
|
407
vendor/golang.org/x/sys/unix/mksyscall.go
generated
vendored
407
vendor/golang.org/x/sys/unix/mksyscall.go
generated
vendored
|
@ -1,407 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
This program reads a file containing function prototypes
|
|
||||||
(like syscall_darwin.go) and generates system call bodies.
|
|
||||||
The prototypes are marked by lines beginning with "//sys"
|
|
||||||
and read like func declarations if //sys is replaced by func, but:
|
|
||||||
* The parameter lists must give a name for each argument.
|
|
||||||
This includes return parameters.
|
|
||||||
* The parameter lists must give a type for each argument:
|
|
||||||
the (x, y, z int) shorthand is not allowed.
|
|
||||||
* If the return parameter is an error number, it must be named errno.
|
|
||||||
|
|
||||||
A line beginning with //sysnb is like //sys, except that the
|
|
||||||
goroutine will not be suspended during the execution of the system
|
|
||||||
call. This must only be used for system calls which can never
|
|
||||||
block, as otherwise the system call could cause all goroutines to
|
|
||||||
hang.
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
b32 = flag.Bool("b32", false, "32bit big-endian")
|
|
||||||
l32 = flag.Bool("l32", false, "32bit little-endian")
|
|
||||||
plan9 = flag.Bool("plan9", false, "plan9")
|
|
||||||
openbsd = flag.Bool("openbsd", false, "openbsd")
|
|
||||||
netbsd = flag.Bool("netbsd", false, "netbsd")
|
|
||||||
dragonfly = flag.Bool("dragonfly", false, "dragonfly")
|
|
||||||
arm = flag.Bool("arm", false, "arm") // 64-bit value should use (even, odd)-pair
|
|
||||||
tags = flag.String("tags", "", "build tags")
|
|
||||||
filename = flag.String("output", "", "output file name (standard output if omitted)")
|
|
||||||
)
|
|
||||||
|
|
||||||
// cmdLine returns this programs's commandline arguments
|
|
||||||
func cmdLine() string {
|
|
||||||
return "go run mksyscall.go " + strings.Join(os.Args[1:], " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildTags returns build tags
|
|
||||||
func buildTags() string {
|
|
||||||
return *tags
|
|
||||||
}
|
|
||||||
|
|
||||||
// Param is function parameter
|
|
||||||
type Param struct {
|
|
||||||
Name string
|
|
||||||
Type string
|
|
||||||
}
|
|
||||||
|
|
||||||
// usage prints the program usage
|
|
||||||
func usage() {
|
|
||||||
fmt.Fprintf(os.Stderr, "usage: go run mksyscall.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParamList parses parameter list and returns a slice of parameters
|
|
||||||
func parseParamList(list string) []string {
|
|
||||||
list = strings.TrimSpace(list)
|
|
||||||
if list == "" {
|
|
||||||
return []string{}
|
|
||||||
}
|
|
||||||
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParam splits a parameter into name and type
|
|
||||||
func parseParam(p string) Param {
|
|
||||||
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
|
||||||
if ps == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
return Param{ps[1], ps[2]}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Get the OS and architecture (using GOARCH_TARGET if it exists)
|
|
||||||
goos := os.Getenv("GOOS")
|
|
||||||
if goos == "" {
|
|
||||||
fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
goarch := os.Getenv("GOARCH_TARGET")
|
|
||||||
if goarch == "" {
|
|
||||||
goarch = os.Getenv("GOARCH")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that we are using the Docker-based build system if we should
|
|
||||||
if goos == "linux" {
|
|
||||||
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
|
|
||||||
fmt.Fprintf(os.Stderr, "In the Docker-based build system, mksyscall should not be called directly.\n")
|
|
||||||
fmt.Fprintf(os.Stderr, "See README.md\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flag.Usage = usage
|
|
||||||
flag.Parse()
|
|
||||||
if len(flag.Args()) <= 0 {
|
|
||||||
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
|
||||||
usage()
|
|
||||||
}
|
|
||||||
|
|
||||||
endianness := ""
|
|
||||||
if *b32 {
|
|
||||||
endianness = "big-endian"
|
|
||||||
} else if *l32 {
|
|
||||||
endianness = "little-endian"
|
|
||||||
}
|
|
||||||
|
|
||||||
libc := false
|
|
||||||
if goos == "darwin" && strings.Contains(buildTags(), ",go1.12") {
|
|
||||||
libc = true
|
|
||||||
}
|
|
||||||
trampolines := map[string]bool{}
|
|
||||||
|
|
||||||
text := ""
|
|
||||||
for _, path := range flag.Args() {
|
|
||||||
file, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
s := bufio.NewScanner(file)
|
|
||||||
for s.Scan() {
|
|
||||||
t := s.Text()
|
|
||||||
t = strings.TrimSpace(t)
|
|
||||||
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
|
||||||
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
|
||||||
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Line must be of the form
|
|
||||||
// func Open(path string, mode int, perm int) (fd int, errno error)
|
|
||||||
// Split into name, in params, out params.
|
|
||||||
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t)
|
|
||||||
if f == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
|
|
||||||
|
|
||||||
// ClockGettime doesn't have a syscall number on Darwin, only generate libc wrappers.
|
|
||||||
if goos == "darwin" && !libc && funct == "ClockGettime" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Split argument lists on comma.
|
|
||||||
in := parseParamList(inps)
|
|
||||||
out := parseParamList(outps)
|
|
||||||
|
|
||||||
// Try in vain to keep people from editing this file.
|
|
||||||
// The theory is that they jump into the middle of the file
|
|
||||||
// without reading the header.
|
|
||||||
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
|
||||||
|
|
||||||
// Go function header.
|
|
||||||
outDecl := ""
|
|
||||||
if len(out) > 0 {
|
|
||||||
outDecl = fmt.Sprintf(" (%s)", strings.Join(out, ", "))
|
|
||||||
}
|
|
||||||
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outDecl)
|
|
||||||
|
|
||||||
// Check if err return available
|
|
||||||
errvar := ""
|
|
||||||
for _, param := range out {
|
|
||||||
p := parseParam(param)
|
|
||||||
if p.Type == "error" {
|
|
||||||
errvar = p.Name
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare arguments to Syscall.
|
|
||||||
var args []string
|
|
||||||
n := 0
|
|
||||||
for _, param := range in {
|
|
||||||
p := parseParam(param)
|
|
||||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
|
|
||||||
} else if p.Type == "string" && errvar != "" {
|
|
||||||
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
|
|
||||||
text += fmt.Sprintf("\t_p%d, %s = BytePtrFromString(%s)\n", n, errvar, p.Name)
|
|
||||||
text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "string" {
|
|
||||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
|
||||||
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
|
|
||||||
text += fmt.Sprintf("\t_p%d, _ = BytePtrFromString(%s)\n", n, p.Name)
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
|
||||||
n++
|
|
||||||
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
// Convert slice into pointer, length.
|
|
||||||
// Have to be careful not to take address of &a[0] if len == 0:
|
|
||||||
// pass dummy pointer in that case.
|
|
||||||
// Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
|
|
||||||
text += fmt.Sprintf("\tvar _p%d unsafe.Pointer\n", n)
|
|
||||||
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = unsafe.Pointer(&%s[0])\n\t}", p.Name, n, p.Name)
|
|
||||||
text += fmt.Sprintf(" else {\n\t\t_p%d = unsafe.Pointer(&_zero)\n\t}\n", n)
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(_p%d)", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "int64" && (*openbsd || *netbsd) {
|
|
||||||
args = append(args, "0")
|
|
||||||
if endianness == "big-endian" {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
} else if endianness == "little-endian" {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
}
|
|
||||||
} else if p.Type == "int64" && *dragonfly {
|
|
||||||
if regexp.MustCompile(`^(?i)extp(read|write)`).FindStringSubmatch(funct) == nil {
|
|
||||||
args = append(args, "0")
|
|
||||||
}
|
|
||||||
if endianness == "big-endian" {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
} else if endianness == "little-endian" {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
}
|
|
||||||
} else if (p.Type == "int64" || p.Type == "uint64") && endianness != "" {
|
|
||||||
if len(args)%2 == 1 && *arm {
|
|
||||||
// arm abi specifies 64-bit argument uses
|
|
||||||
// (even, odd) pair
|
|
||||||
args = append(args, "0")
|
|
||||||
}
|
|
||||||
if endianness == "big-endian" {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine which form to use; pad args with zeros.
|
|
||||||
asm := "Syscall"
|
|
||||||
if nonblock != nil {
|
|
||||||
if errvar == "" && goos == "linux" {
|
|
||||||
asm = "RawSyscallNoError"
|
|
||||||
} else {
|
|
||||||
asm = "RawSyscall"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if errvar == "" && goos == "linux" {
|
|
||||||
asm = "SyscallNoError"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(args) <= 3 {
|
|
||||||
for len(args) < 3 {
|
|
||||||
args = append(args, "0")
|
|
||||||
}
|
|
||||||
} else if len(args) <= 6 {
|
|
||||||
asm += "6"
|
|
||||||
for len(args) < 6 {
|
|
||||||
args = append(args, "0")
|
|
||||||
}
|
|
||||||
} else if len(args) <= 9 {
|
|
||||||
asm += "9"
|
|
||||||
for len(args) < 9 {
|
|
||||||
args = append(args, "0")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s:%s too many arguments to system call\n", path, funct)
|
|
||||||
}
|
|
||||||
|
|
||||||
// System call number.
|
|
||||||
if sysname == "" {
|
|
||||||
sysname = "SYS_" + funct
|
|
||||||
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
|
||||||
sysname = strings.ToUpper(sysname)
|
|
||||||
}
|
|
||||||
|
|
||||||
var libcFn string
|
|
||||||
if libc {
|
|
||||||
asm = "syscall_" + strings.ToLower(asm[:1]) + asm[1:] // internal syscall call
|
|
||||||
sysname = strings.TrimPrefix(sysname, "SYS_") // remove SYS_
|
|
||||||
sysname = strings.ToLower(sysname) // lowercase
|
|
||||||
if sysname == "getdirentries64" {
|
|
||||||
// Special case - libSystem name and
|
|
||||||
// raw syscall name don't match.
|
|
||||||
sysname = "__getdirentries64"
|
|
||||||
}
|
|
||||||
libcFn = sysname
|
|
||||||
sysname = "funcPC(libc_" + sysname + "_trampoline)"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actual call.
|
|
||||||
arglist := strings.Join(args, ", ")
|
|
||||||
call := fmt.Sprintf("%s(%s, %s)", asm, sysname, arglist)
|
|
||||||
|
|
||||||
// Assign return values.
|
|
||||||
body := ""
|
|
||||||
ret := []string{"_", "_", "_"}
|
|
||||||
doErrno := false
|
|
||||||
for i := 0; i < len(out); i++ {
|
|
||||||
p := parseParam(out[i])
|
|
||||||
reg := ""
|
|
||||||
if p.Name == "err" && !*plan9 {
|
|
||||||
reg = "e1"
|
|
||||||
ret[2] = reg
|
|
||||||
doErrno = true
|
|
||||||
} else if p.Name == "err" && *plan9 {
|
|
||||||
ret[0] = "r0"
|
|
||||||
ret[2] = "e1"
|
|
||||||
break
|
|
||||||
} else {
|
|
||||||
reg = fmt.Sprintf("r%d", i)
|
|
||||||
ret[i] = reg
|
|
||||||
}
|
|
||||||
if p.Type == "bool" {
|
|
||||||
reg = fmt.Sprintf("%s != 0", reg)
|
|
||||||
}
|
|
||||||
if p.Type == "int64" && endianness != "" {
|
|
||||||
// 64-bit number in r1:r0 or r0:r1.
|
|
||||||
if i+2 > len(out) {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s:%s not enough registers for int64 return\n", path, funct)
|
|
||||||
}
|
|
||||||
if endianness == "big-endian" {
|
|
||||||
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
|
|
||||||
} else {
|
|
||||||
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
|
|
||||||
}
|
|
||||||
ret[i] = fmt.Sprintf("r%d", i)
|
|
||||||
ret[i+1] = fmt.Sprintf("r%d", i+1)
|
|
||||||
}
|
|
||||||
if reg != "e1" || *plan9 {
|
|
||||||
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
|
|
||||||
text += fmt.Sprintf("\t%s\n", call)
|
|
||||||
} else {
|
|
||||||
if errvar == "" && goos == "linux" {
|
|
||||||
// raw syscall without error on Linux, see golang.org/issue/22924
|
|
||||||
text += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], call)
|
|
||||||
} else {
|
|
||||||
text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text += body
|
|
||||||
|
|
||||||
if *plan9 && ret[2] == "e1" {
|
|
||||||
text += "\tif int32(r0) == -1 {\n"
|
|
||||||
text += "\t\terr = e1\n"
|
|
||||||
text += "\t}\n"
|
|
||||||
} else if doErrno {
|
|
||||||
text += "\tif e1 != 0 {\n"
|
|
||||||
text += "\t\terr = errnoErr(e1)\n"
|
|
||||||
text += "\t}\n"
|
|
||||||
}
|
|
||||||
text += "\treturn\n"
|
|
||||||
text += "}\n\n"
|
|
||||||
|
|
||||||
if libc && !trampolines[libcFn] {
|
|
||||||
// some system calls share a trampoline, like read and readlen.
|
|
||||||
trampolines[libcFn] = true
|
|
||||||
// Declare assembly trampoline.
|
|
||||||
text += fmt.Sprintf("func libc_%s_trampoline()\n", libcFn)
|
|
||||||
// Assembly trampoline calls the libc_* function, which this magic
|
|
||||||
// redirects to use the function from libSystem.
|
|
||||||
text += fmt.Sprintf("//go:linkname libc_%s libc_%s\n", libcFn, libcFn)
|
|
||||||
text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn)
|
|
||||||
text += "\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := s.Err(); err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
file.Close()
|
|
||||||
}
|
|
||||||
fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
|
|
||||||
}
|
|
||||||
|
|
||||||
const srcTemplate = `// %s
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
var _ syscall.Errno
|
|
||||||
|
|
||||||
%s
|
|
||||||
`
|
|
415
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go
generated
vendored
415
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go
generated
vendored
|
@ -1,415 +0,0 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
This program reads a file containing function prototypes
|
|
||||||
(like syscall_aix.go) and generates system call bodies.
|
|
||||||
The prototypes are marked by lines beginning with "//sys"
|
|
||||||
and read like func declarations if //sys is replaced by func, but:
|
|
||||||
* The parameter lists must give a name for each argument.
|
|
||||||
This includes return parameters.
|
|
||||||
* The parameter lists must give a type for each argument:
|
|
||||||
the (x, y, z int) shorthand is not allowed.
|
|
||||||
* If the return parameter is an error number, it must be named err.
|
|
||||||
* If go func name needs to be different than its libc name,
|
|
||||||
* or the function is not in libc, name could be specified
|
|
||||||
* at the end, after "=" sign, like
|
|
||||||
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
b32 = flag.Bool("b32", false, "32bit big-endian")
|
|
||||||
l32 = flag.Bool("l32", false, "32bit little-endian")
|
|
||||||
aix = flag.Bool("aix", false, "aix")
|
|
||||||
tags = flag.String("tags", "", "build tags")
|
|
||||||
)
|
|
||||||
|
|
||||||
// cmdLine returns this programs's commandline arguments
|
|
||||||
func cmdLine() string {
|
|
||||||
return "go run mksyscall_aix_ppc.go " + strings.Join(os.Args[1:], " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildTags returns build tags
|
|
||||||
func buildTags() string {
|
|
||||||
return *tags
|
|
||||||
}
|
|
||||||
|
|
||||||
// Param is function parameter
|
|
||||||
type Param struct {
|
|
||||||
Name string
|
|
||||||
Type string
|
|
||||||
}
|
|
||||||
|
|
||||||
// usage prints the program usage
|
|
||||||
func usage() {
|
|
||||||
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParamList parses parameter list and returns a slice of parameters
|
|
||||||
func parseParamList(list string) []string {
|
|
||||||
list = strings.TrimSpace(list)
|
|
||||||
if list == "" {
|
|
||||||
return []string{}
|
|
||||||
}
|
|
||||||
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParam splits a parameter into name and type
|
|
||||||
func parseParam(p string) Param {
|
|
||||||
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
|
||||||
if ps == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
return Param{ps[1], ps[2]}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Usage = usage
|
|
||||||
flag.Parse()
|
|
||||||
if len(flag.Args()) <= 0 {
|
|
||||||
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
|
||||||
usage()
|
|
||||||
}
|
|
||||||
|
|
||||||
endianness := ""
|
|
||||||
if *b32 {
|
|
||||||
endianness = "big-endian"
|
|
||||||
} else if *l32 {
|
|
||||||
endianness = "little-endian"
|
|
||||||
}
|
|
||||||
|
|
||||||
pack := ""
|
|
||||||
text := ""
|
|
||||||
cExtern := "/*\n#include <stdint.h>\n#include <stddef.h>\n"
|
|
||||||
for _, path := range flag.Args() {
|
|
||||||
file, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
s := bufio.NewScanner(file)
|
|
||||||
for s.Scan() {
|
|
||||||
t := s.Text()
|
|
||||||
t = strings.TrimSpace(t)
|
|
||||||
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
|
||||||
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
|
||||||
pack = p[1]
|
|
||||||
}
|
|
||||||
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
|
||||||
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Line must be of the form
|
|
||||||
// func Open(path string, mode int, perm int) (fd int, err error)
|
|
||||||
// Split into name, in params, out params.
|
|
||||||
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
|
||||||
if f == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
|
||||||
|
|
||||||
// Split argument lists on comma.
|
|
||||||
in := parseParamList(inps)
|
|
||||||
out := parseParamList(outps)
|
|
||||||
|
|
||||||
inps = strings.Join(in, ", ")
|
|
||||||
outps = strings.Join(out, ", ")
|
|
||||||
|
|
||||||
// Try in vain to keep people from editing this file.
|
|
||||||
// The theory is that they jump into the middle of the file
|
|
||||||
// without reading the header.
|
|
||||||
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
|
||||||
|
|
||||||
// Check if value return, err return available
|
|
||||||
errvar := ""
|
|
||||||
retvar := ""
|
|
||||||
rettype := ""
|
|
||||||
for _, param := range out {
|
|
||||||
p := parseParam(param)
|
|
||||||
if p.Type == "error" {
|
|
||||||
errvar = p.Name
|
|
||||||
} else {
|
|
||||||
retvar = p.Name
|
|
||||||
rettype = p.Type
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// System call name.
|
|
||||||
if sysname == "" {
|
|
||||||
sysname = funct
|
|
||||||
}
|
|
||||||
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
|
||||||
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
|
||||||
|
|
||||||
cRettype := ""
|
|
||||||
if rettype == "unsafe.Pointer" {
|
|
||||||
cRettype = "uintptr_t"
|
|
||||||
} else if rettype == "uintptr" {
|
|
||||||
cRettype = "uintptr_t"
|
|
||||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
|
|
||||||
cRettype = "uintptr_t"
|
|
||||||
} else if rettype == "int" {
|
|
||||||
cRettype = "int"
|
|
||||||
} else if rettype == "int32" {
|
|
||||||
cRettype = "int"
|
|
||||||
} else if rettype == "int64" {
|
|
||||||
cRettype = "long long"
|
|
||||||
} else if rettype == "uint32" {
|
|
||||||
cRettype = "unsigned int"
|
|
||||||
} else if rettype == "uint64" {
|
|
||||||
cRettype = "unsigned long long"
|
|
||||||
} else {
|
|
||||||
cRettype = "int"
|
|
||||||
}
|
|
||||||
if sysname == "exit" {
|
|
||||||
cRettype = "void"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change p.Types to c
|
|
||||||
var cIn []string
|
|
||||||
for _, param := range in {
|
|
||||||
p := parseParam(param)
|
|
||||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if p.Type == "string" {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
cIn = append(cIn, "uintptr_t", "size_t")
|
|
||||||
} else if p.Type == "unsafe.Pointer" {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if p.Type == "uintptr" {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if p.Type == "int" {
|
|
||||||
cIn = append(cIn, "int")
|
|
||||||
} else if p.Type == "int32" {
|
|
||||||
cIn = append(cIn, "int")
|
|
||||||
} else if p.Type == "int64" {
|
|
||||||
cIn = append(cIn, "long long")
|
|
||||||
} else if p.Type == "uint32" {
|
|
||||||
cIn = append(cIn, "unsigned int")
|
|
||||||
} else if p.Type == "uint64" {
|
|
||||||
cIn = append(cIn, "unsigned long long")
|
|
||||||
} else {
|
|
||||||
cIn = append(cIn, "int")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" {
|
|
||||||
if sysname == "select" {
|
|
||||||
// select is a keyword of Go. Its name is
|
|
||||||
// changed to c_select.
|
|
||||||
cExtern += "#define c_select select\n"
|
|
||||||
}
|
|
||||||
// Imports of system calls from libc
|
|
||||||
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
|
|
||||||
cIn := strings.Join(cIn, ", ")
|
|
||||||
cExtern += fmt.Sprintf("(%s);\n", cIn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// So file name.
|
|
||||||
if *aix {
|
|
||||||
if modname == "" {
|
|
||||||
modname = "libc.a/shr_64.o"
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
strconvfunc := "C.CString"
|
|
||||||
|
|
||||||
// Go function header.
|
|
||||||
if outps != "" {
|
|
||||||
outps = fmt.Sprintf(" (%s)", outps)
|
|
||||||
}
|
|
||||||
if text != "" {
|
|
||||||
text += "\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
|
|
||||||
|
|
||||||
// Prepare arguments to Syscall.
|
|
||||||
var args []string
|
|
||||||
n := 0
|
|
||||||
argN := 0
|
|
||||||
for _, param := range in {
|
|
||||||
p := parseParam(param)
|
|
||||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
args = append(args, "C.uintptr_t(uintptr(unsafe.Pointer("+p.Name+")))")
|
|
||||||
} else if p.Type == "string" && errvar != "" {
|
|
||||||
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "string" {
|
|
||||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
|
||||||
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
|
||||||
n++
|
|
||||||
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
|
|
||||||
// Convert slice into pointer, length.
|
|
||||||
// Have to be careful not to take address of &a[0] if len == 0:
|
|
||||||
// pass nil in that case.
|
|
||||||
text += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
|
|
||||||
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(unsafe.Pointer(_p%d)))", n))
|
|
||||||
n++
|
|
||||||
text += fmt.Sprintf("\tvar _p%d int\n", n)
|
|
||||||
text += fmt.Sprintf("\t_p%d = len(%s)\n", n, p.Name)
|
|
||||||
args = append(args, fmt.Sprintf("C.size_t(_p%d)", n))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "int64" && endianness != "" {
|
|
||||||
if endianness == "big-endian" {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
|
||||||
}
|
|
||||||
n++
|
|
||||||
} else if p.Type == "bool" {
|
|
||||||
text += fmt.Sprintf("\tvar _p%d uint32\n", n)
|
|
||||||
text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
|
|
||||||
args = append(args, fmt.Sprintf("_p%d", n))
|
|
||||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
|
|
||||||
} else if p.Type == "unsafe.Pointer" {
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
|
|
||||||
} else if p.Type == "int" {
|
|
||||||
if (argN == 2) && ((funct == "readlen") || (funct == "writelen")) {
|
|
||||||
args = append(args, fmt.Sprintf("C.size_t(%s)", p.Name))
|
|
||||||
} else if argN == 0 && funct == "fcntl" {
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
|
||||||
} else if (argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt")) {
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
|
||||||
}
|
|
||||||
} else if p.Type == "int32" {
|
|
||||||
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
|
||||||
} else if p.Type == "int64" {
|
|
||||||
args = append(args, fmt.Sprintf("C.longlong(%s)", p.Name))
|
|
||||||
} else if p.Type == "uint32" {
|
|
||||||
args = append(args, fmt.Sprintf("C.uint(%s)", p.Name))
|
|
||||||
} else if p.Type == "uint64" {
|
|
||||||
args = append(args, fmt.Sprintf("C.ulonglong(%s)", p.Name))
|
|
||||||
} else if p.Type == "uintptr" {
|
|
||||||
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
|
||||||
}
|
|
||||||
argN++
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actual call.
|
|
||||||
arglist := strings.Join(args, ", ")
|
|
||||||
call := ""
|
|
||||||
if sysname == "exit" {
|
|
||||||
if errvar != "" {
|
|
||||||
call += "er :="
|
|
||||||
} else {
|
|
||||||
call += ""
|
|
||||||
}
|
|
||||||
} else if errvar != "" {
|
|
||||||
call += "r0,er :="
|
|
||||||
} else if retvar != "" {
|
|
||||||
call += "r0,_ :="
|
|
||||||
} else {
|
|
||||||
call += ""
|
|
||||||
}
|
|
||||||
if sysname == "select" {
|
|
||||||
// select is a keyword of Go. Its name is
|
|
||||||
// changed to c_select.
|
|
||||||
call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist)
|
|
||||||
} else {
|
|
||||||
call += fmt.Sprintf("C.%s(%s)", sysname, arglist)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign return values.
|
|
||||||
body := ""
|
|
||||||
for i := 0; i < len(out); i++ {
|
|
||||||
p := parseParam(out[i])
|
|
||||||
reg := ""
|
|
||||||
if p.Name == "err" {
|
|
||||||
reg = "e1"
|
|
||||||
} else {
|
|
||||||
reg = "r0"
|
|
||||||
}
|
|
||||||
if reg != "e1" {
|
|
||||||
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify return
|
|
||||||
if sysname != "exit" && errvar != "" {
|
|
||||||
if regexp.MustCompile(`^uintptr`).FindStringSubmatch(cRettype) != nil {
|
|
||||||
body += "\tif (uintptr(r0) ==^uintptr(0) && er != nil) {\n"
|
|
||||||
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
|
||||||
body += "\t}\n"
|
|
||||||
} else {
|
|
||||||
body += "\tif (r0 ==-1 && er != nil) {\n"
|
|
||||||
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
|
||||||
body += "\t}\n"
|
|
||||||
}
|
|
||||||
} else if errvar != "" {
|
|
||||||
body += "\tif (er != nil) {\n"
|
|
||||||
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
|
||||||
body += "\t}\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
text += fmt.Sprintf("\t%s\n", call)
|
|
||||||
text += body
|
|
||||||
|
|
||||||
text += "\treturn\n"
|
|
||||||
text += "}\n"
|
|
||||||
}
|
|
||||||
if err := s.Err(); err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
file.Close()
|
|
||||||
}
|
|
||||||
imp := ""
|
|
||||||
if pack != "unix" {
|
|
||||||
imp = "import \"golang.org/x/sys/unix\"\n"
|
|
||||||
|
|
||||||
}
|
|
||||||
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, cExtern, imp, text)
|
|
||||||
}
|
|
||||||
|
|
||||||
const srcTemplate = `// %s
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
|
|
||||||
package %s
|
|
||||||
|
|
||||||
|
|
||||||
%s
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
%s
|
|
||||||
`
|
|
614
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go
generated
vendored
614
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go
generated
vendored
|
@ -1,614 +0,0 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
This program reads a file containing function prototypes
|
|
||||||
(like syscall_aix.go) and generates system call bodies.
|
|
||||||
The prototypes are marked by lines beginning with "//sys"
|
|
||||||
and read like func declarations if //sys is replaced by func, but:
|
|
||||||
* The parameter lists must give a name for each argument.
|
|
||||||
This includes return parameters.
|
|
||||||
* The parameter lists must give a type for each argument:
|
|
||||||
the (x, y, z int) shorthand is not allowed.
|
|
||||||
* If the return parameter is an error number, it must be named err.
|
|
||||||
* If go func name needs to be different than its libc name,
|
|
||||||
* or the function is not in libc, name could be specified
|
|
||||||
* at the end, after "=" sign, like
|
|
||||||
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
|
||||||
|
|
||||||
|
|
||||||
This program will generate three files and handle both gc and gccgo implementation:
|
|
||||||
- zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation)
|
|
||||||
- zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6
|
|
||||||
- zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type.
|
|
||||||
|
|
||||||
The generated code looks like this
|
|
||||||
|
|
||||||
zsyscall_aix_ppc64.go
|
|
||||||
func asyscall(...) (n int, err error) {
|
|
||||||
// Pointer Creation
|
|
||||||
r1, e1 := callasyscall(...)
|
|
||||||
// Type Conversion
|
|
||||||
// Error Handler
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
zsyscall_aix_ppc64_gc.go
|
|
||||||
//go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o"
|
|
||||||
//go:linkname libc_asyscall libc_asyscall
|
|
||||||
var asyscall syscallFunc
|
|
||||||
|
|
||||||
func callasyscall(...) (r1 uintptr, e1 Errno) {
|
|
||||||
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... )
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
zsyscall_aix_ppc64_ggcgo.go
|
|
||||||
|
|
||||||
// int asyscall(...)
|
|
||||||
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
func callasyscall(...) (r1 uintptr, e1 Errno) {
|
|
||||||
r1 = uintptr(C.asyscall(...))
|
|
||||||
e1 = syscall.GetErrno()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
b32 = flag.Bool("b32", false, "32bit big-endian")
|
|
||||||
l32 = flag.Bool("l32", false, "32bit little-endian")
|
|
||||||
aix = flag.Bool("aix", false, "aix")
|
|
||||||
tags = flag.String("tags", "", "build tags")
|
|
||||||
)
|
|
||||||
|
|
||||||
// cmdLine returns this programs's commandline arguments
|
|
||||||
func cmdLine() string {
|
|
||||||
return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildTags returns build tags
|
|
||||||
func buildTags() string {
|
|
||||||
return *tags
|
|
||||||
}
|
|
||||||
|
|
||||||
// Param is function parameter
|
|
||||||
type Param struct {
|
|
||||||
Name string
|
|
||||||
Type string
|
|
||||||
}
|
|
||||||
|
|
||||||
// usage prints the program usage
|
|
||||||
func usage() {
|
|
||||||
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc64.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParamList parses parameter list and returns a slice of parameters
|
|
||||||
func parseParamList(list string) []string {
|
|
||||||
list = strings.TrimSpace(list)
|
|
||||||
if list == "" {
|
|
||||||
return []string{}
|
|
||||||
}
|
|
||||||
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParam splits a parameter into name and type
|
|
||||||
func parseParam(p string) Param {
|
|
||||||
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
|
||||||
if ps == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
return Param{ps[1], ps[2]}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Usage = usage
|
|
||||||
flag.Parse()
|
|
||||||
if len(flag.Args()) <= 0 {
|
|
||||||
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
|
||||||
usage()
|
|
||||||
}
|
|
||||||
|
|
||||||
endianness := ""
|
|
||||||
if *b32 {
|
|
||||||
endianness = "big-endian"
|
|
||||||
} else if *l32 {
|
|
||||||
endianness = "little-endian"
|
|
||||||
}
|
|
||||||
|
|
||||||
pack := ""
|
|
||||||
// GCCGO
|
|
||||||
textgccgo := ""
|
|
||||||
cExtern := "/*\n#include <stdint.h>\n"
|
|
||||||
// GC
|
|
||||||
textgc := ""
|
|
||||||
dynimports := ""
|
|
||||||
linknames := ""
|
|
||||||
var vars []string
|
|
||||||
// COMMON
|
|
||||||
textcommon := ""
|
|
||||||
for _, path := range flag.Args() {
|
|
||||||
file, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
s := bufio.NewScanner(file)
|
|
||||||
for s.Scan() {
|
|
||||||
t := s.Text()
|
|
||||||
t = strings.TrimSpace(t)
|
|
||||||
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
|
||||||
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
|
||||||
pack = p[1]
|
|
||||||
}
|
|
||||||
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
|
||||||
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Line must be of the form
|
|
||||||
// func Open(path string, mode int, perm int) (fd int, err error)
|
|
||||||
// Split into name, in params, out params.
|
|
||||||
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
|
||||||
if f == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
|
||||||
|
|
||||||
// Split argument lists on comma.
|
|
||||||
in := parseParamList(inps)
|
|
||||||
out := parseParamList(outps)
|
|
||||||
|
|
||||||
inps = strings.Join(in, ", ")
|
|
||||||
outps = strings.Join(out, ", ")
|
|
||||||
|
|
||||||
if sysname == "" {
|
|
||||||
sysname = funct
|
|
||||||
}
|
|
||||||
|
|
||||||
onlyCommon := false
|
|
||||||
if funct == "readlen" || funct == "writelen" || funct == "FcntlInt" || funct == "FcntlFlock" {
|
|
||||||
// This function call another syscall which is already implemented.
|
|
||||||
// Therefore, the gc and gccgo part must not be generated.
|
|
||||||
onlyCommon = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try in vain to keep people from editing this file.
|
|
||||||
// The theory is that they jump into the middle of the file
|
|
||||||
// without reading the header.
|
|
||||||
|
|
||||||
textcommon += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
|
||||||
if !onlyCommon {
|
|
||||||
textgccgo += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
|
||||||
textgc += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if value return, err return available
|
|
||||||
errvar := ""
|
|
||||||
rettype := ""
|
|
||||||
for _, param := range out {
|
|
||||||
p := parseParam(param)
|
|
||||||
if p.Type == "error" {
|
|
||||||
errvar = p.Name
|
|
||||||
} else {
|
|
||||||
rettype = p.Type
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
|
||||||
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
|
||||||
|
|
||||||
// GCCGO Prototype return type
|
|
||||||
cRettype := ""
|
|
||||||
if rettype == "unsafe.Pointer" {
|
|
||||||
cRettype = "uintptr_t"
|
|
||||||
} else if rettype == "uintptr" {
|
|
||||||
cRettype = "uintptr_t"
|
|
||||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
|
|
||||||
cRettype = "uintptr_t"
|
|
||||||
} else if rettype == "int" {
|
|
||||||
cRettype = "int"
|
|
||||||
} else if rettype == "int32" {
|
|
||||||
cRettype = "int"
|
|
||||||
} else if rettype == "int64" {
|
|
||||||
cRettype = "long long"
|
|
||||||
} else if rettype == "uint32" {
|
|
||||||
cRettype = "unsigned int"
|
|
||||||
} else if rettype == "uint64" {
|
|
||||||
cRettype = "unsigned long long"
|
|
||||||
} else {
|
|
||||||
cRettype = "int"
|
|
||||||
}
|
|
||||||
if sysname == "exit" {
|
|
||||||
cRettype = "void"
|
|
||||||
}
|
|
||||||
|
|
||||||
// GCCGO Prototype arguments type
|
|
||||||
var cIn []string
|
|
||||||
for i, param := range in {
|
|
||||||
p := parseParam(param)
|
|
||||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if p.Type == "string" {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
cIn = append(cIn, "uintptr_t", "size_t")
|
|
||||||
} else if p.Type == "unsafe.Pointer" {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if p.Type == "uintptr" {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else if p.Type == "int" {
|
|
||||||
if (i == 0 || i == 2) && funct == "fcntl" {
|
|
||||||
// These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock
|
|
||||||
cIn = append(cIn, "uintptr_t")
|
|
||||||
} else {
|
|
||||||
cIn = append(cIn, "int")
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if p.Type == "int32" {
|
|
||||||
cIn = append(cIn, "int")
|
|
||||||
} else if p.Type == "int64" {
|
|
||||||
cIn = append(cIn, "long long")
|
|
||||||
} else if p.Type == "uint32" {
|
|
||||||
cIn = append(cIn, "unsigned int")
|
|
||||||
} else if p.Type == "uint64" {
|
|
||||||
cIn = append(cIn, "unsigned long long")
|
|
||||||
} else {
|
|
||||||
cIn = append(cIn, "int")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !onlyCommon {
|
|
||||||
// GCCGO Prototype Generation
|
|
||||||
// Imports of system calls from libc
|
|
||||||
if sysname == "select" {
|
|
||||||
// select is a keyword of Go. Its name is
|
|
||||||
// changed to c_select.
|
|
||||||
cExtern += "#define c_select select\n"
|
|
||||||
}
|
|
||||||
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
|
|
||||||
cIn := strings.Join(cIn, ", ")
|
|
||||||
cExtern += fmt.Sprintf("(%s);\n", cIn)
|
|
||||||
}
|
|
||||||
// GC Library name
|
|
||||||
if modname == "" {
|
|
||||||
modname = "libc.a/shr_64.o"
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
sysvarname := fmt.Sprintf("libc_%s", sysname)
|
|
||||||
|
|
||||||
if !onlyCommon {
|
|
||||||
// GC Runtime import of function to allow cross-platform builds.
|
|
||||||
dynimports += fmt.Sprintf("//go:cgo_import_dynamic %s %s \"%s\"\n", sysvarname, sysname, modname)
|
|
||||||
// GC Link symbol to proc address variable.
|
|
||||||
linknames += fmt.Sprintf("//go:linkname %s %s\n", sysvarname, sysvarname)
|
|
||||||
// GC Library proc address variable.
|
|
||||||
vars = append(vars, sysvarname)
|
|
||||||
}
|
|
||||||
|
|
||||||
strconvfunc := "BytePtrFromString"
|
|
||||||
strconvtype := "*byte"
|
|
||||||
|
|
||||||
// Go function header.
|
|
||||||
if outps != "" {
|
|
||||||
outps = fmt.Sprintf(" (%s)", outps)
|
|
||||||
}
|
|
||||||
if textcommon != "" {
|
|
||||||
textcommon += "\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
textcommon += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
|
|
||||||
|
|
||||||
// Prepare arguments tocall.
|
|
||||||
var argscommon []string // Arguments in the common part
|
|
||||||
var argscall []string // Arguments for call prototype
|
|
||||||
var argsgc []string // Arguments for gc call (with syscall6)
|
|
||||||
var argsgccgo []string // Arguments for gccgo call (with C.name_of_syscall)
|
|
||||||
n := 0
|
|
||||||
argN := 0
|
|
||||||
for _, param := range in {
|
|
||||||
p := parseParam(param)
|
|
||||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.Name))
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
|
||||||
argsgc = append(argsgc, p.Name)
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
|
||||||
} else if p.Type == "string" && errvar != "" {
|
|
||||||
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
|
||||||
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
|
||||||
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
|
||||||
|
|
||||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
|
||||||
argscall = append(argscall, fmt.Sprintf("_p%d uintptr ", n))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "string" {
|
|
||||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
|
||||||
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
|
||||||
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
|
||||||
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
|
||||||
|
|
||||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
|
||||||
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
|
||||||
n++
|
|
||||||
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
|
|
||||||
// Convert slice into pointer, length.
|
|
||||||
// Have to be careful not to take address of &a[0] if len == 0:
|
|
||||||
// pass nil in that case.
|
|
||||||
textcommon += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
|
|
||||||
textcommon += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
|
||||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("len(%s)", p.Name))
|
|
||||||
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n), fmt.Sprintf("_lenp%d int", n))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("_p%d", n), fmt.Sprintf("uintptr(_lenp%d)", n))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n), fmt.Sprintf("C.size_t(_lenp%d)", n))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "int64" && endianness != "" {
|
|
||||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses int64 with 32 bits mode. Case not yet implemented\n")
|
|
||||||
} else if p.Type == "bool" {
|
|
||||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses bool. Case not yet implemented\n")
|
|
||||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil || p.Type == "unsafe.Pointer" {
|
|
||||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
|
||||||
argsgc = append(argsgc, p.Name)
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
|
||||||
} else if p.Type == "int" {
|
|
||||||
if (argN == 0 || argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt") || (funct == "FcntlFlock")) {
|
|
||||||
// These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock
|
|
||||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
|
||||||
argsgc = append(argsgc, p.Name)
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
|
||||||
|
|
||||||
} else {
|
|
||||||
argscommon = append(argscommon, p.Name)
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
|
||||||
}
|
|
||||||
} else if p.Type == "int32" {
|
|
||||||
argscommon = append(argscommon, p.Name)
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s int32", p.Name))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
|
||||||
} else if p.Type == "int64" {
|
|
||||||
argscommon = append(argscommon, p.Name)
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s int64", p.Name))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.longlong(%s)", p.Name))
|
|
||||||
} else if p.Type == "uint32" {
|
|
||||||
argscommon = append(argscommon, p.Name)
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s uint32", p.Name))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uint(%s)", p.Name))
|
|
||||||
} else if p.Type == "uint64" {
|
|
||||||
argscommon = append(argscommon, p.Name)
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s uint64", p.Name))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.ulonglong(%s)", p.Name))
|
|
||||||
} else if p.Type == "uintptr" {
|
|
||||||
argscommon = append(argscommon, p.Name)
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
|
||||||
argsgc = append(argsgc, p.Name)
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
|
||||||
} else {
|
|
||||||
argscommon = append(argscommon, fmt.Sprintf("int(%s)", p.Name))
|
|
||||||
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
|
|
||||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
|
||||||
}
|
|
||||||
argN++
|
|
||||||
}
|
|
||||||
nargs := len(argsgc)
|
|
||||||
|
|
||||||
// COMMON function generation
|
|
||||||
argscommonlist := strings.Join(argscommon, ", ")
|
|
||||||
callcommon := fmt.Sprintf("call%s(%s)", sysname, argscommonlist)
|
|
||||||
ret := []string{"_", "_"}
|
|
||||||
body := ""
|
|
||||||
doErrno := false
|
|
||||||
for i := 0; i < len(out); i++ {
|
|
||||||
p := parseParam(out[i])
|
|
||||||
reg := ""
|
|
||||||
if p.Name == "err" {
|
|
||||||
reg = "e1"
|
|
||||||
ret[1] = reg
|
|
||||||
doErrno = true
|
|
||||||
} else {
|
|
||||||
reg = "r0"
|
|
||||||
ret[0] = reg
|
|
||||||
}
|
|
||||||
if p.Type == "bool" {
|
|
||||||
reg = fmt.Sprintf("%s != 0", reg)
|
|
||||||
}
|
|
||||||
if reg != "e1" {
|
|
||||||
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ret[0] == "_" && ret[1] == "_" {
|
|
||||||
textcommon += fmt.Sprintf("\t%s\n", callcommon)
|
|
||||||
} else {
|
|
||||||
textcommon += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], callcommon)
|
|
||||||
}
|
|
||||||
textcommon += body
|
|
||||||
|
|
||||||
if doErrno {
|
|
||||||
textcommon += "\tif e1 != 0 {\n"
|
|
||||||
textcommon += "\t\terr = errnoErr(e1)\n"
|
|
||||||
textcommon += "\t}\n"
|
|
||||||
}
|
|
||||||
textcommon += "\treturn\n"
|
|
||||||
textcommon += "}\n"
|
|
||||||
|
|
||||||
if onlyCommon {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// CALL Prototype
|
|
||||||
callProto := fmt.Sprintf("func call%s(%s) (r1 uintptr, e1 Errno) {\n", sysname, strings.Join(argscall, ", "))
|
|
||||||
|
|
||||||
// GC function generation
|
|
||||||
asm := "syscall6"
|
|
||||||
if nonblock != nil {
|
|
||||||
asm = "rawSyscall6"
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(argsgc) <= 6 {
|
|
||||||
for len(argsgc) < 6 {
|
|
||||||
argsgc = append(argsgc, "0")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s: too many arguments to system call", funct)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
argsgclist := strings.Join(argsgc, ", ")
|
|
||||||
callgc := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, argsgclist)
|
|
||||||
|
|
||||||
textgc += callProto
|
|
||||||
textgc += fmt.Sprintf("\tr1, _, e1 = %s\n", callgc)
|
|
||||||
textgc += "\treturn\n}\n"
|
|
||||||
|
|
||||||
// GCCGO function generation
|
|
||||||
argsgccgolist := strings.Join(argsgccgo, ", ")
|
|
||||||
var callgccgo string
|
|
||||||
if sysname == "select" {
|
|
||||||
// select is a keyword of Go. Its name is
|
|
||||||
// changed to c_select.
|
|
||||||
callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist)
|
|
||||||
} else {
|
|
||||||
callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist)
|
|
||||||
}
|
|
||||||
textgccgo += callProto
|
|
||||||
textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo)
|
|
||||||
textgccgo += "\te1 = syscall.GetErrno()\n"
|
|
||||||
textgccgo += "\treturn\n}\n"
|
|
||||||
}
|
|
||||||
if err := s.Err(); err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
file.Close()
|
|
||||||
}
|
|
||||||
imp := ""
|
|
||||||
if pack != "unix" {
|
|
||||||
imp = "import \"golang.org/x/sys/unix\"\n"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print zsyscall_aix_ppc64.go
|
|
||||||
err := ioutil.WriteFile("zsyscall_aix_ppc64.go",
|
|
||||||
[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), buildTags(), pack, imp, textcommon)),
|
|
||||||
0644)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print zsyscall_aix_ppc64_gc.go
|
|
||||||
vardecls := "\t" + strings.Join(vars, ",\n\t")
|
|
||||||
vardecls += " syscallFunc"
|
|
||||||
err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go",
|
|
||||||
[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
|
|
||||||
0644)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print zsyscall_aix_ppc64_gccgo.go
|
|
||||||
err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go",
|
|
||||||
[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), buildTags(), pack, cExtern, imp, textgccgo)),
|
|
||||||
0644)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const srcTemplate1 = `// %s
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
|
|
||||||
package %s
|
|
||||||
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
%s
|
|
||||||
`
|
|
||||||
const srcTemplate2 = `// %s
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
// +build !gccgo
|
|
||||||
|
|
||||||
package %s
|
|
||||||
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
%s
|
|
||||||
%s
|
|
||||||
%s
|
|
||||||
type syscallFunc uintptr
|
|
||||||
|
|
||||||
var (
|
|
||||||
%s
|
|
||||||
)
|
|
||||||
|
|
||||||
// Implemented in runtime/syscall_aix.go.
|
|
||||||
func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
|
||||||
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
|
||||||
|
|
||||||
%s
|
|
||||||
`
|
|
||||||
const srcTemplate3 = `// %s
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
// +build gccgo
|
|
||||||
|
|
||||||
package %s
|
|
||||||
|
|
||||||
%s
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
%s
|
|
||||||
`
|
|
335
vendor/golang.org/x/sys/unix/mksyscall_solaris.go
generated
vendored
335
vendor/golang.org/x/sys/unix/mksyscall_solaris.go
generated
vendored
|
@ -1,335 +0,0 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
This program reads a file containing function prototypes
|
|
||||||
(like syscall_solaris.go) and generates system call bodies.
|
|
||||||
The prototypes are marked by lines beginning with "//sys"
|
|
||||||
and read like func declarations if //sys is replaced by func, but:
|
|
||||||
* The parameter lists must give a name for each argument.
|
|
||||||
This includes return parameters.
|
|
||||||
* The parameter lists must give a type for each argument:
|
|
||||||
the (x, y, z int) shorthand is not allowed.
|
|
||||||
* If the return parameter is an error number, it must be named err.
|
|
||||||
* If go func name needs to be different than its libc name,
|
|
||||||
* or the function is not in libc, name could be specified
|
|
||||||
* at the end, after "=" sign, like
|
|
||||||
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
b32 = flag.Bool("b32", false, "32bit big-endian")
|
|
||||||
l32 = flag.Bool("l32", false, "32bit little-endian")
|
|
||||||
tags = flag.String("tags", "", "build tags")
|
|
||||||
)
|
|
||||||
|
|
||||||
// cmdLine returns this programs's commandline arguments
|
|
||||||
func cmdLine() string {
|
|
||||||
return "go run mksyscall_solaris.go " + strings.Join(os.Args[1:], " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildTags returns build tags
|
|
||||||
func buildTags() string {
|
|
||||||
return *tags
|
|
||||||
}
|
|
||||||
|
|
||||||
// Param is function parameter
|
|
||||||
type Param struct {
|
|
||||||
Name string
|
|
||||||
Type string
|
|
||||||
}
|
|
||||||
|
|
||||||
// usage prints the program usage
|
|
||||||
func usage() {
|
|
||||||
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_solaris.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParamList parses parameter list and returns a slice of parameters
|
|
||||||
func parseParamList(list string) []string {
|
|
||||||
list = strings.TrimSpace(list)
|
|
||||||
if list == "" {
|
|
||||||
return []string{}
|
|
||||||
}
|
|
||||||
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseParam splits a parameter into name and type
|
|
||||||
func parseParam(p string) Param {
|
|
||||||
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
|
||||||
if ps == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
return Param{ps[1], ps[2]}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Usage = usage
|
|
||||||
flag.Parse()
|
|
||||||
if len(flag.Args()) <= 0 {
|
|
||||||
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
|
||||||
usage()
|
|
||||||
}
|
|
||||||
|
|
||||||
endianness := ""
|
|
||||||
if *b32 {
|
|
||||||
endianness = "big-endian"
|
|
||||||
} else if *l32 {
|
|
||||||
endianness = "little-endian"
|
|
||||||
}
|
|
||||||
|
|
||||||
pack := ""
|
|
||||||
text := ""
|
|
||||||
dynimports := ""
|
|
||||||
linknames := ""
|
|
||||||
var vars []string
|
|
||||||
for _, path := range flag.Args() {
|
|
||||||
file, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
s := bufio.NewScanner(file)
|
|
||||||
for s.Scan() {
|
|
||||||
t := s.Text()
|
|
||||||
t = strings.TrimSpace(t)
|
|
||||||
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
|
||||||
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
|
||||||
pack = p[1]
|
|
||||||
}
|
|
||||||
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
|
||||||
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Line must be of the form
|
|
||||||
// func Open(path string, mode int, perm int) (fd int, err error)
|
|
||||||
// Split into name, in params, out params.
|
|
||||||
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
|
||||||
if f == nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
|
||||||
|
|
||||||
// Split argument lists on comma.
|
|
||||||
in := parseParamList(inps)
|
|
||||||
out := parseParamList(outps)
|
|
||||||
|
|
||||||
inps = strings.Join(in, ", ")
|
|
||||||
outps = strings.Join(out, ", ")
|
|
||||||
|
|
||||||
// Try in vain to keep people from editing this file.
|
|
||||||
// The theory is that they jump into the middle of the file
|
|
||||||
// without reading the header.
|
|
||||||
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
|
||||||
|
|
||||||
// So file name.
|
|
||||||
if modname == "" {
|
|
||||||
modname = "libc"
|
|
||||||
}
|
|
||||||
|
|
||||||
// System call name.
|
|
||||||
if sysname == "" {
|
|
||||||
sysname = funct
|
|
||||||
}
|
|
||||||
|
|
||||||
// System call pointer variable name.
|
|
||||||
sysvarname := fmt.Sprintf("proc%s", sysname)
|
|
||||||
|
|
||||||
strconvfunc := "BytePtrFromString"
|
|
||||||
strconvtype := "*byte"
|
|
||||||
|
|
||||||
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
|
||||||
|
|
||||||
// Runtime import of function to allow cross-platform builds.
|
|
||||||
dynimports += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"%s.so\"\n", sysname, sysname, modname)
|
|
||||||
// Link symbol to proc address variable.
|
|
||||||
linknames += fmt.Sprintf("//go:linkname %s libc_%s\n", sysvarname, sysname)
|
|
||||||
// Library proc address variable.
|
|
||||||
vars = append(vars, sysvarname)
|
|
||||||
|
|
||||||
// Go function header.
|
|
||||||
outlist := strings.Join(out, ", ")
|
|
||||||
if outlist != "" {
|
|
||||||
outlist = fmt.Sprintf(" (%s)", outlist)
|
|
||||||
}
|
|
||||||
if text != "" {
|
|
||||||
text += "\n"
|
|
||||||
}
|
|
||||||
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outlist)
|
|
||||||
|
|
||||||
// Check if err return available
|
|
||||||
errvar := ""
|
|
||||||
for _, param := range out {
|
|
||||||
p := parseParam(param)
|
|
||||||
if p.Type == "error" {
|
|
||||||
errvar = p.Name
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare arguments to Syscall.
|
|
||||||
var args []string
|
|
||||||
n := 0
|
|
||||||
for _, param := range in {
|
|
||||||
p := parseParam(param)
|
|
||||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
|
||||||
args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
|
|
||||||
} else if p.Type == "string" && errvar != "" {
|
|
||||||
text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
|
||||||
text += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
|
||||||
text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "string" {
|
|
||||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
|
||||||
text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
|
||||||
text += fmt.Sprintf("\t_p%d, _ = %s(%s)\n", n, strconvfunc, p.Name)
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
|
||||||
n++
|
|
||||||
} else if s := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); s != nil {
|
|
||||||
// Convert slice into pointer, length.
|
|
||||||
// Have to be careful not to take address of &a[0] if len == 0:
|
|
||||||
// pass nil in that case.
|
|
||||||
text += fmt.Sprintf("\tvar _p%d *%s\n", n, s[1])
|
|
||||||
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
|
|
||||||
n++
|
|
||||||
} else if p.Type == "int64" && endianness != "" {
|
|
||||||
if endianness == "big-endian" {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
|
||||||
}
|
|
||||||
} else if p.Type == "bool" {
|
|
||||||
text += fmt.Sprintf("\tvar _p%d uint32\n", n)
|
|
||||||
text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(_p%d)", n))
|
|
||||||
n++
|
|
||||||
} else {
|
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nargs := len(args)
|
|
||||||
|
|
||||||
// Determine which form to use; pad args with zeros.
|
|
||||||
asm := "sysvicall6"
|
|
||||||
if nonblock != nil {
|
|
||||||
asm = "rawSysvicall6"
|
|
||||||
}
|
|
||||||
if len(args) <= 6 {
|
|
||||||
for len(args) < 6 {
|
|
||||||
args = append(args, "0")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s: too many arguments to system call\n", path)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actual call.
|
|
||||||
arglist := strings.Join(args, ", ")
|
|
||||||
call := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, arglist)
|
|
||||||
|
|
||||||
// Assign return values.
|
|
||||||
body := ""
|
|
||||||
ret := []string{"_", "_", "_"}
|
|
||||||
doErrno := false
|
|
||||||
for i := 0; i < len(out); i++ {
|
|
||||||
p := parseParam(out[i])
|
|
||||||
reg := ""
|
|
||||||
if p.Name == "err" {
|
|
||||||
reg = "e1"
|
|
||||||
ret[2] = reg
|
|
||||||
doErrno = true
|
|
||||||
} else {
|
|
||||||
reg = fmt.Sprintf("r%d", i)
|
|
||||||
ret[i] = reg
|
|
||||||
}
|
|
||||||
if p.Type == "bool" {
|
|
||||||
reg = fmt.Sprintf("%d != 0", reg)
|
|
||||||
}
|
|
||||||
if p.Type == "int64" && endianness != "" {
|
|
||||||
// 64-bit number in r1:r0 or r0:r1.
|
|
||||||
if i+2 > len(out) {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s: not enough registers for int64 return\n", path)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
if endianness == "big-endian" {
|
|
||||||
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
|
|
||||||
} else {
|
|
||||||
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
|
|
||||||
}
|
|
||||||
ret[i] = fmt.Sprintf("r%d", i)
|
|
||||||
ret[i+1] = fmt.Sprintf("r%d", i+1)
|
|
||||||
}
|
|
||||||
if reg != "e1" {
|
|
||||||
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
|
|
||||||
text += fmt.Sprintf("\t%s\n", call)
|
|
||||||
} else {
|
|
||||||
text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
|
|
||||||
}
|
|
||||||
text += body
|
|
||||||
|
|
||||||
if doErrno {
|
|
||||||
text += "\tif e1 != 0 {\n"
|
|
||||||
text += "\t\terr = e1\n"
|
|
||||||
text += "\t}\n"
|
|
||||||
}
|
|
||||||
text += "\treturn\n"
|
|
||||||
text += "}\n"
|
|
||||||
}
|
|
||||||
if err := s.Err(); err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
file.Close()
|
|
||||||
}
|
|
||||||
imp := ""
|
|
||||||
if pack != "unix" {
|
|
||||||
imp = "import \"golang.org/x/sys/unix\"\n"
|
|
||||||
|
|
||||||
}
|
|
||||||
vardecls := "\t" + strings.Join(vars, ",\n\t")
|
|
||||||
vardecls += " syscallFunc"
|
|
||||||
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, text)
|
|
||||||
}
|
|
||||||
|
|
||||||
const srcTemplate = `// %s
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
|
|
||||||
package %s
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
%s
|
|
||||||
%s
|
|
||||||
%s
|
|
||||||
var (
|
|
||||||
%s
|
|
||||||
)
|
|
||||||
|
|
||||||
%s
|
|
||||||
`
|
|
355
vendor/golang.org/x/sys/unix/mksysctl_openbsd.go
generated
vendored
355
vendor/golang.org/x/sys/unix/mksysctl_openbsd.go
generated
vendored
|
@ -1,355 +0,0 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
// Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
|
|
||||||
//
|
|
||||||
// Build a MIB with each entry being an array containing the level, type and
|
|
||||||
// a hash that will contain additional entries if the current entry is a node.
|
|
||||||
// We then walk this MIB and create a flattened sysctl name to OID hash.
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
goos, goarch string
|
|
||||||
)
|
|
||||||
|
|
||||||
// cmdLine returns this programs's commandline arguments.
|
|
||||||
func cmdLine() string {
|
|
||||||
return "go run mksysctl_openbsd.go " + strings.Join(os.Args[1:], " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildTags returns build tags.
|
|
||||||
func buildTags() string {
|
|
||||||
return fmt.Sprintf("%s,%s", goarch, goos)
|
|
||||||
}
|
|
||||||
|
|
||||||
// reMatch performs regular expression match and stores the substring slice to value pointed by m.
|
|
||||||
func reMatch(re *regexp.Regexp, str string, m *[]string) bool {
|
|
||||||
*m = re.FindStringSubmatch(str)
|
|
||||||
if *m != nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type nodeElement struct {
|
|
||||||
n int
|
|
||||||
t string
|
|
||||||
pE *map[string]nodeElement
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
debugEnabled bool
|
|
||||||
mib map[string]nodeElement
|
|
||||||
node *map[string]nodeElement
|
|
||||||
nodeMap map[string]string
|
|
||||||
sysCtl []string
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ctlNames1RE = regexp.MustCompile(`^#define\s+(CTL_NAMES)\s+{`)
|
|
||||||
ctlNames2RE = regexp.MustCompile(`^#define\s+(CTL_(.*)_NAMES)\s+{`)
|
|
||||||
ctlNames3RE = regexp.MustCompile(`^#define\s+((.*)CTL_NAMES)\s+{`)
|
|
||||||
netInetRE = regexp.MustCompile(`^netinet/`)
|
|
||||||
netInet6RE = regexp.MustCompile(`^netinet6/`)
|
|
||||||
netRE = regexp.MustCompile(`^net/`)
|
|
||||||
bracesRE = regexp.MustCompile(`{.*}`)
|
|
||||||
ctlTypeRE = regexp.MustCompile(`{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}`)
|
|
||||||
fsNetKernRE = regexp.MustCompile(`^(fs|net|kern)_`)
|
|
||||||
)
|
|
||||||
|
|
||||||
func debug(s string) {
|
|
||||||
if debugEnabled {
|
|
||||||
fmt.Fprintln(os.Stderr, s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Walk the MIB and build a sysctl name to OID mapping.
|
|
||||||
func buildSysctl(pNode *map[string]nodeElement, name string, oid []int) {
|
|
||||||
lNode := pNode // local copy of pointer to node
|
|
||||||
var keys []string
|
|
||||||
for k := range *lNode {
|
|
||||||
keys = append(keys, k)
|
|
||||||
}
|
|
||||||
sort.Strings(keys)
|
|
||||||
|
|
||||||
for _, key := range keys {
|
|
||||||
nodename := name
|
|
||||||
if name != "" {
|
|
||||||
nodename += "."
|
|
||||||
}
|
|
||||||
nodename += key
|
|
||||||
|
|
||||||
nodeoid := append(oid, (*pNode)[key].n)
|
|
||||||
|
|
||||||
if (*pNode)[key].t == `CTLTYPE_NODE` {
|
|
||||||
if _, ok := nodeMap[nodename]; ok {
|
|
||||||
lNode = &mib
|
|
||||||
ctlName := nodeMap[nodename]
|
|
||||||
for _, part := range strings.Split(ctlName, ".") {
|
|
||||||
lNode = ((*lNode)[part]).pE
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lNode = (*pNode)[key].pE
|
|
||||||
}
|
|
||||||
buildSysctl(lNode, nodename, nodeoid)
|
|
||||||
} else if (*pNode)[key].t != "" {
|
|
||||||
oidStr := []string{}
|
|
||||||
for j := range nodeoid {
|
|
||||||
oidStr = append(oidStr, fmt.Sprintf("%d", nodeoid[j]))
|
|
||||||
}
|
|
||||||
text := "\t{ \"" + nodename + "\", []_C_int{ " + strings.Join(oidStr, ", ") + " } }, \n"
|
|
||||||
sysCtl = append(sysCtl, text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Get the OS (using GOOS_TARGET if it exist)
|
|
||||||
goos = os.Getenv("GOOS_TARGET")
|
|
||||||
if goos == "" {
|
|
||||||
goos = os.Getenv("GOOS")
|
|
||||||
}
|
|
||||||
// Get the architecture (using GOARCH_TARGET if it exists)
|
|
||||||
goarch = os.Getenv("GOARCH_TARGET")
|
|
||||||
if goarch == "" {
|
|
||||||
goarch = os.Getenv("GOARCH")
|
|
||||||
}
|
|
||||||
// Check if GOOS and GOARCH environment variables are defined
|
|
||||||
if goarch == "" || goos == "" {
|
|
||||||
fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
mib = make(map[string]nodeElement)
|
|
||||||
headers := [...]string{
|
|
||||||
`sys/sysctl.h`,
|
|
||||||
`sys/socket.h`,
|
|
||||||
`sys/tty.h`,
|
|
||||||
`sys/malloc.h`,
|
|
||||||
`sys/mount.h`,
|
|
||||||
`sys/namei.h`,
|
|
||||||
`sys/sem.h`,
|
|
||||||
`sys/shm.h`,
|
|
||||||
`sys/vmmeter.h`,
|
|
||||||
`uvm/uvmexp.h`,
|
|
||||||
`uvm/uvm_param.h`,
|
|
||||||
`uvm/uvm_swap_encrypt.h`,
|
|
||||||
`ddb/db_var.h`,
|
|
||||||
`net/if.h`,
|
|
||||||
`net/if_pfsync.h`,
|
|
||||||
`net/pipex.h`,
|
|
||||||
`netinet/in.h`,
|
|
||||||
`netinet/icmp_var.h`,
|
|
||||||
`netinet/igmp_var.h`,
|
|
||||||
`netinet/ip_ah.h`,
|
|
||||||
`netinet/ip_carp.h`,
|
|
||||||
`netinet/ip_divert.h`,
|
|
||||||
`netinet/ip_esp.h`,
|
|
||||||
`netinet/ip_ether.h`,
|
|
||||||
`netinet/ip_gre.h`,
|
|
||||||
`netinet/ip_ipcomp.h`,
|
|
||||||
`netinet/ip_ipip.h`,
|
|
||||||
`netinet/pim_var.h`,
|
|
||||||
`netinet/tcp_var.h`,
|
|
||||||
`netinet/udp_var.h`,
|
|
||||||
`netinet6/in6.h`,
|
|
||||||
`netinet6/ip6_divert.h`,
|
|
||||||
`netinet6/pim6_var.h`,
|
|
||||||
`netinet/icmp6.h`,
|
|
||||||
`netmpls/mpls.h`,
|
|
||||||
}
|
|
||||||
|
|
||||||
ctls := [...]string{
|
|
||||||
`kern`,
|
|
||||||
`vm`,
|
|
||||||
`fs`,
|
|
||||||
`net`,
|
|
||||||
//debug /* Special handling required */
|
|
||||||
`hw`,
|
|
||||||
//machdep /* Arch specific */
|
|
||||||
`user`,
|
|
||||||
`ddb`,
|
|
||||||
//vfs /* Special handling required */
|
|
||||||
`fs.posix`,
|
|
||||||
`kern.forkstat`,
|
|
||||||
`kern.intrcnt`,
|
|
||||||
`kern.malloc`,
|
|
||||||
`kern.nchstats`,
|
|
||||||
`kern.seminfo`,
|
|
||||||
`kern.shminfo`,
|
|
||||||
`kern.timecounter`,
|
|
||||||
`kern.tty`,
|
|
||||||
`kern.watchdog`,
|
|
||||||
`net.bpf`,
|
|
||||||
`net.ifq`,
|
|
||||||
`net.inet`,
|
|
||||||
`net.inet.ah`,
|
|
||||||
`net.inet.carp`,
|
|
||||||
`net.inet.divert`,
|
|
||||||
`net.inet.esp`,
|
|
||||||
`net.inet.etherip`,
|
|
||||||
`net.inet.gre`,
|
|
||||||
`net.inet.icmp`,
|
|
||||||
`net.inet.igmp`,
|
|
||||||
`net.inet.ip`,
|
|
||||||
`net.inet.ip.ifq`,
|
|
||||||
`net.inet.ipcomp`,
|
|
||||||
`net.inet.ipip`,
|
|
||||||
`net.inet.mobileip`,
|
|
||||||
`net.inet.pfsync`,
|
|
||||||
`net.inet.pim`,
|
|
||||||
`net.inet.tcp`,
|
|
||||||
`net.inet.udp`,
|
|
||||||
`net.inet6`,
|
|
||||||
`net.inet6.divert`,
|
|
||||||
`net.inet6.ip6`,
|
|
||||||
`net.inet6.icmp6`,
|
|
||||||
`net.inet6.pim6`,
|
|
||||||
`net.inet6.tcp6`,
|
|
||||||
`net.inet6.udp6`,
|
|
||||||
`net.mpls`,
|
|
||||||
`net.mpls.ifq`,
|
|
||||||
`net.key`,
|
|
||||||
`net.pflow`,
|
|
||||||
`net.pfsync`,
|
|
||||||
`net.pipex`,
|
|
||||||
`net.rt`,
|
|
||||||
`vm.swapencrypt`,
|
|
||||||
//vfsgenctl /* Special handling required */
|
|
||||||
}
|
|
||||||
|
|
||||||
// Node name "fixups"
|
|
||||||
ctlMap := map[string]string{
|
|
||||||
"ipproto": "net.inet",
|
|
||||||
"net.inet.ipproto": "net.inet",
|
|
||||||
"net.inet6.ipv6proto": "net.inet6",
|
|
||||||
"net.inet6.ipv6": "net.inet6.ip6",
|
|
||||||
"net.inet.icmpv6": "net.inet6.icmp6",
|
|
||||||
"net.inet6.divert6": "net.inet6.divert",
|
|
||||||
"net.inet6.tcp6": "net.inet.tcp",
|
|
||||||
"net.inet6.udp6": "net.inet.udp",
|
|
||||||
"mpls": "net.mpls",
|
|
||||||
"swpenc": "vm.swapencrypt",
|
|
||||||
}
|
|
||||||
|
|
||||||
// Node mappings
|
|
||||||
nodeMap = map[string]string{
|
|
||||||
"net.inet.ip.ifq": "net.ifq",
|
|
||||||
"net.inet.pfsync": "net.pfsync",
|
|
||||||
"net.mpls.ifq": "net.ifq",
|
|
||||||
}
|
|
||||||
|
|
||||||
mCtls := make(map[string]bool)
|
|
||||||
for _, ctl := range ctls {
|
|
||||||
mCtls[ctl] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, header := range headers {
|
|
||||||
debug("Processing " + header)
|
|
||||||
file, err := os.Open(filepath.Join("/usr/include", header))
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
s := bufio.NewScanner(file)
|
|
||||||
for s.Scan() {
|
|
||||||
var sub []string
|
|
||||||
if reMatch(ctlNames1RE, s.Text(), &sub) ||
|
|
||||||
reMatch(ctlNames2RE, s.Text(), &sub) ||
|
|
||||||
reMatch(ctlNames3RE, s.Text(), &sub) {
|
|
||||||
if sub[1] == `CTL_NAMES` {
|
|
||||||
// Top level.
|
|
||||||
node = &mib
|
|
||||||
} else {
|
|
||||||
// Node.
|
|
||||||
nodename := strings.ToLower(sub[2])
|
|
||||||
ctlName := ""
|
|
||||||
if reMatch(netInetRE, header, &sub) {
|
|
||||||
ctlName = "net.inet." + nodename
|
|
||||||
} else if reMatch(netInet6RE, header, &sub) {
|
|
||||||
ctlName = "net.inet6." + nodename
|
|
||||||
} else if reMatch(netRE, header, &sub) {
|
|
||||||
ctlName = "net." + nodename
|
|
||||||
} else {
|
|
||||||
ctlName = nodename
|
|
||||||
ctlName = fsNetKernRE.ReplaceAllString(ctlName, `$1.`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if val, ok := ctlMap[ctlName]; ok {
|
|
||||||
ctlName = val
|
|
||||||
}
|
|
||||||
if _, ok := mCtls[ctlName]; !ok {
|
|
||||||
debug("Ignoring " + ctlName + "...")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Walk down from the top of the MIB.
|
|
||||||
node = &mib
|
|
||||||
for _, part := range strings.Split(ctlName, ".") {
|
|
||||||
if _, ok := (*node)[part]; !ok {
|
|
||||||
debug("Missing node " + part)
|
|
||||||
(*node)[part] = nodeElement{n: 0, t: "", pE: &map[string]nodeElement{}}
|
|
||||||
}
|
|
||||||
node = (*node)[part].pE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Populate current node with entries.
|
|
||||||
i := -1
|
|
||||||
for !strings.HasPrefix(s.Text(), "}") {
|
|
||||||
s.Scan()
|
|
||||||
if reMatch(bracesRE, s.Text(), &sub) {
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
if !reMatch(ctlTypeRE, s.Text(), &sub) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
(*node)[sub[1]] = nodeElement{n: i, t: sub[2], pE: &map[string]nodeElement{}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = s.Err()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
file.Close()
|
|
||||||
}
|
|
||||||
buildSysctl(&mib, "", []int{})
|
|
||||||
|
|
||||||
sort.Strings(sysCtl)
|
|
||||||
text := strings.Join(sysCtl, "")
|
|
||||||
|
|
||||||
fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
|
|
||||||
}
|
|
||||||
|
|
||||||
const srcTemplate = `// %s
|
|
||||||
// Code generated by the command above; DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
type mibentry struct {
|
|
||||||
ctlname string
|
|
||||||
ctloid []_C_int
|
|
||||||
}
|
|
||||||
|
|
||||||
var sysctlMib = []mibentry {
|
|
||||||
%s
|
|
||||||
}
|
|
||||||
`
|
|
190
vendor/golang.org/x/sys/unix/mksysnum.go
generated
vendored
190
vendor/golang.org/x/sys/unix/mksysnum.go
generated
vendored
|
@ -1,190 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
// Generate system call table for DragonFly, NetBSD,
|
|
||||||
// FreeBSD, OpenBSD or Darwin from master list
|
|
||||||
// (for example, /usr/src/sys/kern/syscalls.master or
|
|
||||||
// sys/syscall.h).
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
goos, goarch string
|
|
||||||
)
|
|
||||||
|
|
||||||
// cmdLine returns this programs's commandline arguments
|
|
||||||
func cmdLine() string {
|
|
||||||
return "go run mksysnum.go " + strings.Join(os.Args[1:], " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildTags returns build tags
|
|
||||||
func buildTags() string {
|
|
||||||
return fmt.Sprintf("%s,%s", goarch, goos)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkErr(err error) {
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// source string and substring slice for regexp
|
|
||||||
type re struct {
|
|
||||||
str string // source string
|
|
||||||
sub []string // matched sub-string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Match performs regular expression match
|
|
||||||
func (r *re) Match(exp string) bool {
|
|
||||||
r.sub = regexp.MustCompile(exp).FindStringSubmatch(r.str)
|
|
||||||
if r.sub != nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// fetchFile fetches a text file from URL
|
|
||||||
func fetchFile(URL string) io.Reader {
|
|
||||||
resp, err := http.Get(URL)
|
|
||||||
checkErr(err)
|
|
||||||
defer resp.Body.Close()
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
|
||||||
checkErr(err)
|
|
||||||
return strings.NewReader(string(body))
|
|
||||||
}
|
|
||||||
|
|
||||||
// readFile reads a text file from path
|
|
||||||
func readFile(path string) io.Reader {
|
|
||||||
file, err := os.Open(os.Args[1])
|
|
||||||
checkErr(err)
|
|
||||||
return file
|
|
||||||
}
|
|
||||||
|
|
||||||
func format(name, num, proto string) string {
|
|
||||||
name = strings.ToUpper(name)
|
|
||||||
// There are multiple entries for enosys and nosys, so comment them out.
|
|
||||||
nm := re{str: name}
|
|
||||||
if nm.Match(`^SYS_E?NOSYS$`) {
|
|
||||||
name = fmt.Sprintf("// %s", name)
|
|
||||||
}
|
|
||||||
if name == `SYS_SYS_EXIT` {
|
|
||||||
name = `SYS_EXIT`
|
|
||||||
}
|
|
||||||
return fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Get the OS (using GOOS_TARGET if it exist)
|
|
||||||
goos = os.Getenv("GOOS_TARGET")
|
|
||||||
if goos == "" {
|
|
||||||
goos = os.Getenv("GOOS")
|
|
||||||
}
|
|
||||||
// Get the architecture (using GOARCH_TARGET if it exists)
|
|
||||||
goarch = os.Getenv("GOARCH_TARGET")
|
|
||||||
if goarch == "" {
|
|
||||||
goarch = os.Getenv("GOARCH")
|
|
||||||
}
|
|
||||||
// Check if GOOS and GOARCH environment variables are defined
|
|
||||||
if goarch == "" || goos == "" {
|
|
||||||
fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
file := strings.TrimSpace(os.Args[1])
|
|
||||||
var syscalls io.Reader
|
|
||||||
if strings.HasPrefix(file, "https://") || strings.HasPrefix(file, "http://") {
|
|
||||||
// Download syscalls.master file
|
|
||||||
syscalls = fetchFile(file)
|
|
||||||
} else {
|
|
||||||
syscalls = readFile(file)
|
|
||||||
}
|
|
||||||
|
|
||||||
var text, line string
|
|
||||||
s := bufio.NewScanner(syscalls)
|
|
||||||
for s.Scan() {
|
|
||||||
t := re{str: line}
|
|
||||||
if t.Match(`^(.*)\\$`) {
|
|
||||||
// Handle continuation
|
|
||||||
line = t.sub[1]
|
|
||||||
line += strings.TrimLeft(s.Text(), " \t")
|
|
||||||
} else {
|
|
||||||
// New line
|
|
||||||
line = s.Text()
|
|
||||||
}
|
|
||||||
t = re{str: line}
|
|
||||||
if t.Match(`\\$`) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t = re{str: line}
|
|
||||||
|
|
||||||
switch goos {
|
|
||||||
case "dragonfly":
|
|
||||||
if t.Match(`^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$`) {
|
|
||||||
num, proto := t.sub[1], t.sub[2]
|
|
||||||
name := fmt.Sprintf("SYS_%s", t.sub[3])
|
|
||||||
text += format(name, num, proto)
|
|
||||||
}
|
|
||||||
case "freebsd":
|
|
||||||
if t.Match(`^([0-9]+)\s+\S+\s+(?:(?:NO)?STD|COMPAT10)\s+({ \S+\s+(\w+).*)$`) {
|
|
||||||
num, proto := t.sub[1], t.sub[2]
|
|
||||||
name := fmt.Sprintf("SYS_%s", t.sub[3])
|
|
||||||
text += format(name, num, proto)
|
|
||||||
}
|
|
||||||
case "openbsd":
|
|
||||||
if t.Match(`^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$`) {
|
|
||||||
num, proto, name := t.sub[1], t.sub[3], t.sub[4]
|
|
||||||
text += format(name, num, proto)
|
|
||||||
}
|
|
||||||
case "netbsd":
|
|
||||||
if t.Match(`^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$`) {
|
|
||||||
num, proto, compat := t.sub[1], t.sub[6], t.sub[8]
|
|
||||||
name := t.sub[7] + "_" + t.sub[9]
|
|
||||||
if t.sub[11] != "" {
|
|
||||||
name = t.sub[7] + "_" + t.sub[11]
|
|
||||||
}
|
|
||||||
name = strings.ToUpper(name)
|
|
||||||
if compat == "" || compat == "13" || compat == "30" || compat == "50" {
|
|
||||||
text += fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "darwin":
|
|
||||||
if t.Match(`^#define\s+SYS_(\w+)\s+([0-9]+)`) {
|
|
||||||
name, num := t.sub[1], t.sub[2]
|
|
||||||
name = strings.ToUpper(name)
|
|
||||||
text += fmt.Sprintf(" SYS_%s = %s;\n", name, num)
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
fmt.Fprintf(os.Stderr, "unrecognized GOOS=%s\n", goos)
|
|
||||||
os.Exit(1)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err := s.Err()
|
|
||||||
checkErr(err)
|
|
||||||
|
|
||||||
fmt.Printf(template, cmdLine(), buildTags(), text)
|
|
||||||
}
|
|
||||||
|
|
||||||
const template = `// %s
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build %s
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const(
|
|
||||||
%s)`
|
|
1
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
|
@ -89,7 +89,6 @@ func direntNamlen(buf []byte) (uint64, bool) {
|
||||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
|
|
||||||
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
|
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
|
||||||
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
|
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
|
||||||
|
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
|
@ -10,6 +10,8 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
||||||
}
|
}
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
|
@ -10,6 +10,8 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
return Timespec{Sec: sec, Nsec: nsec}
|
return Timespec{Sec: sec, Nsec: nsec}
|
||||||
}
|
}
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
|
@ -8,6 +8,10 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
|
||||||
|
return ENOTSUP
|
||||||
|
}
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
||||||
}
|
}
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
|
@ -10,6 +10,10 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
|
||||||
|
return ENOTSUP
|
||||||
|
}
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
return Timespec{Sec: sec, Nsec: nsec}
|
return Timespec{Sec: sec, Nsec: nsec}
|
||||||
}
|
}
|
||||||
|
|
237
vendor/golang.org/x/sys/unix/types_aix.go
generated
vendored
237
vendor/golang.org/x/sys/unix/types_aix.go
generated
vendored
|
@ -1,237 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
// +build aix
|
|
||||||
|
|
||||||
/*
|
|
||||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
|
||||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/limits.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <utime.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/poll.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/statfs.h>
|
|
||||||
#include <sys/termio.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
|
|
||||||
#include <termios.h>
|
|
||||||
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
sizeofPtr = sizeof(void*),
|
|
||||||
};
|
|
||||||
|
|
||||||
union sockaddr_all {
|
|
||||||
struct sockaddr s1; // this one gets used for fields
|
|
||||||
struct sockaddr_in s2; // these pad it out
|
|
||||||
struct sockaddr_in6 s3;
|
|
||||||
struct sockaddr_un s4;
|
|
||||||
struct sockaddr_dl s5;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_any {
|
|
||||||
struct sockaddr addr;
|
|
||||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
// Machine characteristics
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofPtr = C.sizeofPtr
|
|
||||||
SizeofShort = C.sizeof_short
|
|
||||||
SizeofInt = C.sizeof_int
|
|
||||||
SizeofLong = C.sizeof_long
|
|
||||||
SizeofLongLong = C.sizeof_longlong
|
|
||||||
PathMax = C.PATH_MAX
|
|
||||||
)
|
|
||||||
|
|
||||||
// Basic types
|
|
||||||
|
|
||||||
type (
|
|
||||||
_C_short C.short
|
|
||||||
_C_int C.int
|
|
||||||
_C_long C.long
|
|
||||||
_C_long_long C.longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
type off64 C.off64_t
|
|
||||||
type off C.off_t
|
|
||||||
type Mode_t C.mode_t
|
|
||||||
|
|
||||||
// Time
|
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
|
||||||
|
|
||||||
type Timeval32 C.struct_timeval32
|
|
||||||
|
|
||||||
type Timex C.struct_timex
|
|
||||||
|
|
||||||
type Time_t C.time_t
|
|
||||||
|
|
||||||
type Tms C.struct_tms
|
|
||||||
|
|
||||||
type Utimbuf C.struct_utimbuf
|
|
||||||
|
|
||||||
type Timezone C.struct_timezone
|
|
||||||
|
|
||||||
// Processes
|
|
||||||
|
|
||||||
type Rusage C.struct_rusage
|
|
||||||
|
|
||||||
type Rlimit C.struct_rlimit64
|
|
||||||
|
|
||||||
type Pid_t C.pid_t
|
|
||||||
|
|
||||||
type _Gid_t C.gid_t
|
|
||||||
|
|
||||||
type dev_t C.dev_t
|
|
||||||
|
|
||||||
// Files
|
|
||||||
|
|
||||||
type Stat_t C.struct_stat
|
|
||||||
|
|
||||||
type StatxTimestamp C.struct_statx_timestamp
|
|
||||||
|
|
||||||
type Statx_t C.struct_statx
|
|
||||||
|
|
||||||
type Dirent C.struct_dirent
|
|
||||||
|
|
||||||
// Sockets
|
|
||||||
|
|
||||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
|
||||||
|
|
||||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
|
||||||
|
|
||||||
type RawSockaddrDatalink C.struct_sockaddr_dl
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
|
||||||
|
|
||||||
type _Socklen C.socklen_t
|
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
|
||||||
|
|
||||||
type ICMPv6Filter C.struct_icmp6_filter
|
|
||||||
|
|
||||||
type Iovec C.struct_iovec
|
|
||||||
|
|
||||||
type IPMreq C.struct_ip_mreq
|
|
||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
|
||||||
|
|
||||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
|
||||||
|
|
||||||
type Linger C.struct_linger
|
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
|
||||||
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
// Routing and interface messages
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofIfMsghdr = C.sizeof_struct_if_msghdr
|
|
||||||
)
|
|
||||||
|
|
||||||
type IfMsgHdr C.struct_if_msghdr
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
|
|
||||||
type FdSet C.fd_set
|
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
|
||||||
|
|
||||||
type Ustat_t C.struct_ustat
|
|
||||||
|
|
||||||
type Sigset_t C.sigset_t
|
|
||||||
|
|
||||||
const (
|
|
||||||
AT_FDCWD = C.AT_FDCWD
|
|
||||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
|
||||||
)
|
|
||||||
|
|
||||||
// Terminal handling
|
|
||||||
|
|
||||||
type Termios C.struct_termios
|
|
||||||
|
|
||||||
type Termio C.struct_termio
|
|
||||||
|
|
||||||
type Winsize C.struct_winsize
|
|
||||||
|
|
||||||
//poll
|
|
||||||
|
|
||||||
type PollFd struct {
|
|
||||||
Fd int32
|
|
||||||
Events uint16
|
|
||||||
Revents uint16
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLRDBAND = C.POLLRDBAND
|
|
||||||
POLLRDNORM = C.POLLRDNORM
|
|
||||||
POLLWRBAND = C.POLLWRBAND
|
|
||||||
POLLWRNORM = C.POLLWRNORM
|
|
||||||
)
|
|
||||||
|
|
||||||
//flock_t
|
|
||||||
|
|
||||||
type Flock_t C.struct_flock64
|
|
||||||
|
|
||||||
// Statfs
|
|
||||||
|
|
||||||
type Fsid_t C.struct_fsid_t
|
|
||||||
type Fsid64_t C.struct_fsid64_t
|
|
||||||
|
|
||||||
type Statfs_t C.struct_statfs
|
|
||||||
|
|
||||||
const RNDGETENTCNT = 0x80045200
|
|
283
vendor/golang.org/x/sys/unix/types_darwin.go
generated
vendored
283
vendor/golang.org/x/sys/unix/types_darwin.go
generated
vendored
|
@ -1,283 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
Input to cgo -godefs. See README.md
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
|
||||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define __DARWIN_UNIX03 0
|
|
||||||
#define KERNEL
|
|
||||||
#define _DARWIN_USE_64_BIT_INODE
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <mach/mach.h>
|
|
||||||
#include <mach/message.h>
|
|
||||||
#include <sys/event.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/ptrace.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/signal.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <net/bpf.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <net/if_var.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
sizeofPtr = sizeof(void*),
|
|
||||||
};
|
|
||||||
|
|
||||||
union sockaddr_all {
|
|
||||||
struct sockaddr s1; // this one gets used for fields
|
|
||||||
struct sockaddr_in s2; // these pad it out
|
|
||||||
struct sockaddr_in6 s3;
|
|
||||||
struct sockaddr_un s4;
|
|
||||||
struct sockaddr_dl s5;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_any {
|
|
||||||
struct sockaddr addr;
|
|
||||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
// Machine characteristics
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofPtr = C.sizeofPtr
|
|
||||||
SizeofShort = C.sizeof_short
|
|
||||||
SizeofInt = C.sizeof_int
|
|
||||||
SizeofLong = C.sizeof_long
|
|
||||||
SizeofLongLong = C.sizeof_longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Basic types
|
|
||||||
|
|
||||||
type (
|
|
||||||
_C_short C.short
|
|
||||||
_C_int C.int
|
|
||||||
_C_long C.long
|
|
||||||
_C_long_long C.longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Time
|
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
|
||||||
|
|
||||||
type Timeval32 C.struct_timeval32
|
|
||||||
|
|
||||||
// Processes
|
|
||||||
|
|
||||||
type Rusage C.struct_rusage
|
|
||||||
|
|
||||||
type Rlimit C.struct_rlimit
|
|
||||||
|
|
||||||
type _Gid_t C.gid_t
|
|
||||||
|
|
||||||
// Files
|
|
||||||
|
|
||||||
type Stat_t C.struct_stat64
|
|
||||||
|
|
||||||
type Statfs_t C.struct_statfs64
|
|
||||||
|
|
||||||
type Flock_t C.struct_flock
|
|
||||||
|
|
||||||
type Fstore_t C.struct_fstore
|
|
||||||
|
|
||||||
type Radvisory_t C.struct_radvisory
|
|
||||||
|
|
||||||
type Fbootstraptransfer_t C.struct_fbootstraptransfer
|
|
||||||
|
|
||||||
type Log2phys_t C.struct_log2phys
|
|
||||||
|
|
||||||
type Fsid C.struct_fsid
|
|
||||||
|
|
||||||
type Dirent C.struct_dirent
|
|
||||||
|
|
||||||
// Sockets
|
|
||||||
|
|
||||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
|
||||||
|
|
||||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
|
||||||
|
|
||||||
type RawSockaddrDatalink C.struct_sockaddr_dl
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
|
||||||
|
|
||||||
type _Socklen C.socklen_t
|
|
||||||
|
|
||||||
type Linger C.struct_linger
|
|
||||||
|
|
||||||
type Iovec C.struct_iovec
|
|
||||||
|
|
||||||
type IPMreq C.struct_ip_mreq
|
|
||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
|
||||||
|
|
||||||
type Inet4Pktinfo C.struct_in_pktinfo
|
|
||||||
|
|
||||||
type Inet6Pktinfo C.struct_in6_pktinfo
|
|
||||||
|
|
||||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
|
||||||
|
|
||||||
type ICMPv6Filter C.struct_icmp6_filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
|
||||||
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
|
||||||
SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
|
|
||||||
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
|
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
// Ptrace requests
|
|
||||||
|
|
||||||
const (
|
|
||||||
PTRACE_TRACEME = C.PT_TRACE_ME
|
|
||||||
PTRACE_CONT = C.PT_CONTINUE
|
|
||||||
PTRACE_KILL = C.PT_KILL
|
|
||||||
)
|
|
||||||
|
|
||||||
// Events (kqueue, kevent)
|
|
||||||
|
|
||||||
type Kevent_t C.struct_kevent
|
|
||||||
|
|
||||||
// Select
|
|
||||||
|
|
||||||
type FdSet C.fd_set
|
|
||||||
|
|
||||||
// Routing and interface messages
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofIfMsghdr = C.sizeof_struct_if_msghdr
|
|
||||||
SizeofIfData = C.sizeof_struct_if_data
|
|
||||||
SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
|
|
||||||
SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
|
|
||||||
SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
|
|
||||||
SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
|
|
||||||
SizeofRtMetrics = C.sizeof_struct_rt_metrics
|
|
||||||
)
|
|
||||||
|
|
||||||
type IfMsghdr C.struct_if_msghdr
|
|
||||||
|
|
||||||
type IfData C.struct_if_data
|
|
||||||
|
|
||||||
type IfaMsghdr C.struct_ifa_msghdr
|
|
||||||
|
|
||||||
type IfmaMsghdr C.struct_ifma_msghdr
|
|
||||||
|
|
||||||
type IfmaMsghdr2 C.struct_ifma_msghdr2
|
|
||||||
|
|
||||||
type RtMsghdr C.struct_rt_msghdr
|
|
||||||
|
|
||||||
type RtMetrics C.struct_rt_metrics
|
|
||||||
|
|
||||||
// Berkeley packet filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofBpfVersion = C.sizeof_struct_bpf_version
|
|
||||||
SizeofBpfStat = C.sizeof_struct_bpf_stat
|
|
||||||
SizeofBpfProgram = C.sizeof_struct_bpf_program
|
|
||||||
SizeofBpfInsn = C.sizeof_struct_bpf_insn
|
|
||||||
SizeofBpfHdr = C.sizeof_struct_bpf_hdr
|
|
||||||
)
|
|
||||||
|
|
||||||
type BpfVersion C.struct_bpf_version
|
|
||||||
|
|
||||||
type BpfStat C.struct_bpf_stat
|
|
||||||
|
|
||||||
type BpfProgram C.struct_bpf_program
|
|
||||||
|
|
||||||
type BpfInsn C.struct_bpf_insn
|
|
||||||
|
|
||||||
type BpfHdr C.struct_bpf_hdr
|
|
||||||
|
|
||||||
// Terminal handling
|
|
||||||
|
|
||||||
type Termios C.struct_termios
|
|
||||||
|
|
||||||
type Winsize C.struct_winsize
|
|
||||||
|
|
||||||
// fchmodat-like syscalls.
|
|
||||||
|
|
||||||
const (
|
|
||||||
AT_FDCWD = C.AT_FDCWD
|
|
||||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
|
||||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
|
||||||
)
|
|
||||||
|
|
||||||
// poll
|
|
||||||
|
|
||||||
type PollFd C.struct_pollfd
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLRDBAND = C.POLLRDBAND
|
|
||||||
POLLRDNORM = C.POLLRDNORM
|
|
||||||
POLLWRBAND = C.POLLWRBAND
|
|
||||||
POLLWRNORM = C.POLLWRNORM
|
|
||||||
)
|
|
||||||
|
|
||||||
// uname
|
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
|
||||||
|
|
||||||
// Clockinfo
|
|
||||||
|
|
||||||
const SizeofClockinfo = C.sizeof_struct_clockinfo
|
|
||||||
|
|
||||||
type Clockinfo C.struct_clockinfo
|
|
263
vendor/golang.org/x/sys/unix/types_dragonfly.go
generated
vendored
263
vendor/golang.org/x/sys/unix/types_dragonfly.go
generated
vendored
|
@ -1,263 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
Input to cgo -godefs. See README.md
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
|
||||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define KERNEL
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/event.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/ptrace.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/signal.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <net/bpf.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
sizeofPtr = sizeof(void*),
|
|
||||||
};
|
|
||||||
|
|
||||||
union sockaddr_all {
|
|
||||||
struct sockaddr s1; // this one gets used for fields
|
|
||||||
struct sockaddr_in s2; // these pad it out
|
|
||||||
struct sockaddr_in6 s3;
|
|
||||||
struct sockaddr_un s4;
|
|
||||||
struct sockaddr_dl s5;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_any {
|
|
||||||
struct sockaddr addr;
|
|
||||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
// Machine characteristics
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofPtr = C.sizeofPtr
|
|
||||||
SizeofShort = C.sizeof_short
|
|
||||||
SizeofInt = C.sizeof_int
|
|
||||||
SizeofLong = C.sizeof_long
|
|
||||||
SizeofLongLong = C.sizeof_longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Basic types
|
|
||||||
|
|
||||||
type (
|
|
||||||
_C_short C.short
|
|
||||||
_C_int C.int
|
|
||||||
_C_long C.long
|
|
||||||
_C_long_long C.longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Time
|
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
|
||||||
|
|
||||||
// Processes
|
|
||||||
|
|
||||||
type Rusage C.struct_rusage
|
|
||||||
|
|
||||||
type Rlimit C.struct_rlimit
|
|
||||||
|
|
||||||
type _Gid_t C.gid_t
|
|
||||||
|
|
||||||
// Files
|
|
||||||
|
|
||||||
type Stat_t C.struct_stat
|
|
||||||
|
|
||||||
type Statfs_t C.struct_statfs
|
|
||||||
|
|
||||||
type Flock_t C.struct_flock
|
|
||||||
|
|
||||||
type Dirent C.struct_dirent
|
|
||||||
|
|
||||||
type Fsid C.struct_fsid
|
|
||||||
|
|
||||||
// File system limits
|
|
||||||
|
|
||||||
const (
|
|
||||||
PathMax = C.PATH_MAX
|
|
||||||
)
|
|
||||||
|
|
||||||
// Sockets
|
|
||||||
|
|
||||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
|
||||||
|
|
||||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
|
||||||
|
|
||||||
type RawSockaddrDatalink C.struct_sockaddr_dl
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
|
||||||
|
|
||||||
type _Socklen C.socklen_t
|
|
||||||
|
|
||||||
type Linger C.struct_linger
|
|
||||||
|
|
||||||
type Iovec C.struct_iovec
|
|
||||||
|
|
||||||
type IPMreq C.struct_ip_mreq
|
|
||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
|
||||||
|
|
||||||
type Inet6Pktinfo C.struct_in6_pktinfo
|
|
||||||
|
|
||||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
|
||||||
|
|
||||||
type ICMPv6Filter C.struct_icmp6_filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
|
||||||
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
|
||||||
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
|
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
// Ptrace requests
|
|
||||||
|
|
||||||
const (
|
|
||||||
PTRACE_TRACEME = C.PT_TRACE_ME
|
|
||||||
PTRACE_CONT = C.PT_CONTINUE
|
|
||||||
PTRACE_KILL = C.PT_KILL
|
|
||||||
)
|
|
||||||
|
|
||||||
// Events (kqueue, kevent)
|
|
||||||
|
|
||||||
type Kevent_t C.struct_kevent
|
|
||||||
|
|
||||||
// Select
|
|
||||||
|
|
||||||
type FdSet C.fd_set
|
|
||||||
|
|
||||||
// Routing and interface messages
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofIfMsghdr = C.sizeof_struct_if_msghdr
|
|
||||||
SizeofIfData = C.sizeof_struct_if_data
|
|
||||||
SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
|
|
||||||
SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
|
|
||||||
SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
|
|
||||||
SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
|
|
||||||
SizeofRtMetrics = C.sizeof_struct_rt_metrics
|
|
||||||
)
|
|
||||||
|
|
||||||
type IfMsghdr C.struct_if_msghdr
|
|
||||||
|
|
||||||
type IfData C.struct_if_data
|
|
||||||
|
|
||||||
type IfaMsghdr C.struct_ifa_msghdr
|
|
||||||
|
|
||||||
type IfmaMsghdr C.struct_ifma_msghdr
|
|
||||||
|
|
||||||
type IfAnnounceMsghdr C.struct_if_announcemsghdr
|
|
||||||
|
|
||||||
type RtMsghdr C.struct_rt_msghdr
|
|
||||||
|
|
||||||
type RtMetrics C.struct_rt_metrics
|
|
||||||
|
|
||||||
// Berkeley packet filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofBpfVersion = C.sizeof_struct_bpf_version
|
|
||||||
SizeofBpfStat = C.sizeof_struct_bpf_stat
|
|
||||||
SizeofBpfProgram = C.sizeof_struct_bpf_program
|
|
||||||
SizeofBpfInsn = C.sizeof_struct_bpf_insn
|
|
||||||
SizeofBpfHdr = C.sizeof_struct_bpf_hdr
|
|
||||||
)
|
|
||||||
|
|
||||||
type BpfVersion C.struct_bpf_version
|
|
||||||
|
|
||||||
type BpfStat C.struct_bpf_stat
|
|
||||||
|
|
||||||
type BpfProgram C.struct_bpf_program
|
|
||||||
|
|
||||||
type BpfInsn C.struct_bpf_insn
|
|
||||||
|
|
||||||
type BpfHdr C.struct_bpf_hdr
|
|
||||||
|
|
||||||
// Terminal handling
|
|
||||||
|
|
||||||
type Termios C.struct_termios
|
|
||||||
|
|
||||||
type Winsize C.struct_winsize
|
|
||||||
|
|
||||||
// fchmodat-like syscalls.
|
|
||||||
|
|
||||||
const (
|
|
||||||
AT_FDCWD = C.AT_FDCWD
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
|
||||||
)
|
|
||||||
|
|
||||||
// poll
|
|
||||||
|
|
||||||
type PollFd C.struct_pollfd
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLRDBAND = C.POLLRDBAND
|
|
||||||
POLLRDNORM = C.POLLRDNORM
|
|
||||||
POLLWRBAND = C.POLLWRBAND
|
|
||||||
POLLWRNORM = C.POLLWRNORM
|
|
||||||
)
|
|
||||||
|
|
||||||
// Uname
|
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
|
400
vendor/golang.org/x/sys/unix/types_freebsd.go
generated
vendored
400
vendor/golang.org/x/sys/unix/types_freebsd.go
generated
vendored
|
@ -1,400 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
Input to cgo -godefs. See README.md
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
|
||||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define _WANT_FREEBSD11_STAT 1
|
|
||||||
#define _WANT_FREEBSD11_STATFS 1
|
|
||||||
#define _WANT_FREEBSD11_DIRENT 1
|
|
||||||
#define _WANT_FREEBSD11_KEVENT 1
|
|
||||||
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/capsicum.h>
|
|
||||||
#include <sys/event.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/ptrace.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/signal.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <net/bpf.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
sizeofPtr = sizeof(void*),
|
|
||||||
};
|
|
||||||
|
|
||||||
union sockaddr_all {
|
|
||||||
struct sockaddr s1; // this one gets used for fields
|
|
||||||
struct sockaddr_in s2; // these pad it out
|
|
||||||
struct sockaddr_in6 s3;
|
|
||||||
struct sockaddr_un s4;
|
|
||||||
struct sockaddr_dl s5;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_any {
|
|
||||||
struct sockaddr addr;
|
|
||||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
|
||||||
};
|
|
||||||
|
|
||||||
// This structure is a duplicate of if_data on FreeBSD 8-STABLE.
|
|
||||||
// See /usr/include/net/if.h.
|
|
||||||
struct if_data8 {
|
|
||||||
u_char ifi_type;
|
|
||||||
u_char ifi_physical;
|
|
||||||
u_char ifi_addrlen;
|
|
||||||
u_char ifi_hdrlen;
|
|
||||||
u_char ifi_link_state;
|
|
||||||
u_char ifi_spare_char1;
|
|
||||||
u_char ifi_spare_char2;
|
|
||||||
u_char ifi_datalen;
|
|
||||||
u_long ifi_mtu;
|
|
||||||
u_long ifi_metric;
|
|
||||||
u_long ifi_baudrate;
|
|
||||||
u_long ifi_ipackets;
|
|
||||||
u_long ifi_ierrors;
|
|
||||||
u_long ifi_opackets;
|
|
||||||
u_long ifi_oerrors;
|
|
||||||
u_long ifi_collisions;
|
|
||||||
u_long ifi_ibytes;
|
|
||||||
u_long ifi_obytes;
|
|
||||||
u_long ifi_imcasts;
|
|
||||||
u_long ifi_omcasts;
|
|
||||||
u_long ifi_iqdrops;
|
|
||||||
u_long ifi_noproto;
|
|
||||||
u_long ifi_hwassist;
|
|
||||||
// FIXME: these are now unions, so maybe need to change definitions?
|
|
||||||
#undef ifi_epoch
|
|
||||||
time_t ifi_epoch;
|
|
||||||
#undef ifi_lastchange
|
|
||||||
struct timeval ifi_lastchange;
|
|
||||||
};
|
|
||||||
|
|
||||||
// This structure is a duplicate of if_msghdr on FreeBSD 8-STABLE.
|
|
||||||
// See /usr/include/net/if.h.
|
|
||||||
struct if_msghdr8 {
|
|
||||||
u_short ifm_msglen;
|
|
||||||
u_char ifm_version;
|
|
||||||
u_char ifm_type;
|
|
||||||
int ifm_addrs;
|
|
||||||
int ifm_flags;
|
|
||||||
u_short ifm_index;
|
|
||||||
struct if_data8 ifm_data;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
// Machine characteristics
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofPtr = C.sizeofPtr
|
|
||||||
SizeofShort = C.sizeof_short
|
|
||||||
SizeofInt = C.sizeof_int
|
|
||||||
SizeofLong = C.sizeof_long
|
|
||||||
SizeofLongLong = C.sizeof_longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Basic types
|
|
||||||
|
|
||||||
type (
|
|
||||||
_C_short C.short
|
|
||||||
_C_int C.int
|
|
||||||
_C_long C.long
|
|
||||||
_C_long_long C.longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Time
|
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
|
||||||
|
|
||||||
// Processes
|
|
||||||
|
|
||||||
type Rusage C.struct_rusage
|
|
||||||
|
|
||||||
type Rlimit C.struct_rlimit
|
|
||||||
|
|
||||||
type _Gid_t C.gid_t
|
|
||||||
|
|
||||||
// Files
|
|
||||||
|
|
||||||
const (
|
|
||||||
_statfsVersion = C.STATFS_VERSION
|
|
||||||
_dirblksiz = C.DIRBLKSIZ
|
|
||||||
)
|
|
||||||
|
|
||||||
type Stat_t C.struct_stat
|
|
||||||
|
|
||||||
type stat_freebsd11_t C.struct_freebsd11_stat
|
|
||||||
|
|
||||||
type Statfs_t C.struct_statfs
|
|
||||||
|
|
||||||
type statfs_freebsd11_t C.struct_freebsd11_statfs
|
|
||||||
|
|
||||||
type Flock_t C.struct_flock
|
|
||||||
|
|
||||||
type Dirent C.struct_dirent
|
|
||||||
|
|
||||||
type dirent_freebsd11 C.struct_freebsd11_dirent
|
|
||||||
|
|
||||||
type Fsid C.struct_fsid
|
|
||||||
|
|
||||||
// File system limits
|
|
||||||
|
|
||||||
const (
|
|
||||||
PathMax = C.PATH_MAX
|
|
||||||
)
|
|
||||||
|
|
||||||
// Advice to Fadvise
|
|
||||||
|
|
||||||
const (
|
|
||||||
FADV_NORMAL = C.POSIX_FADV_NORMAL
|
|
||||||
FADV_RANDOM = C.POSIX_FADV_RANDOM
|
|
||||||
FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
|
|
||||||
FADV_WILLNEED = C.POSIX_FADV_WILLNEED
|
|
||||||
FADV_DONTNEED = C.POSIX_FADV_DONTNEED
|
|
||||||
FADV_NOREUSE = C.POSIX_FADV_NOREUSE
|
|
||||||
)
|
|
||||||
|
|
||||||
// Sockets
|
|
||||||
|
|
||||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
|
||||||
|
|
||||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
|
||||||
|
|
||||||
type RawSockaddrDatalink C.struct_sockaddr_dl
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
|
||||||
|
|
||||||
type _Socklen C.socklen_t
|
|
||||||
|
|
||||||
type Linger C.struct_linger
|
|
||||||
|
|
||||||
type Iovec C.struct_iovec
|
|
||||||
|
|
||||||
type IPMreq C.struct_ip_mreq
|
|
||||||
|
|
||||||
type IPMreqn C.struct_ip_mreqn
|
|
||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
|
||||||
|
|
||||||
type Inet6Pktinfo C.struct_in6_pktinfo
|
|
||||||
|
|
||||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
|
||||||
|
|
||||||
type ICMPv6Filter C.struct_icmp6_filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
|
||||||
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
|
||||||
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
|
||||||
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
|
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
// Ptrace requests
|
|
||||||
|
|
||||||
const (
|
|
||||||
PTRACE_ATTACH = C.PT_ATTACH
|
|
||||||
PTRACE_CONT = C.PT_CONTINUE
|
|
||||||
PTRACE_DETACH = C.PT_DETACH
|
|
||||||
PTRACE_GETFPREGS = C.PT_GETFPREGS
|
|
||||||
PTRACE_GETFSBASE = C.PT_GETFSBASE
|
|
||||||
PTRACE_GETLWPLIST = C.PT_GETLWPLIST
|
|
||||||
PTRACE_GETNUMLWPS = C.PT_GETNUMLWPS
|
|
||||||
PTRACE_GETREGS = C.PT_GETREGS
|
|
||||||
PTRACE_GETXSTATE = C.PT_GETXSTATE
|
|
||||||
PTRACE_IO = C.PT_IO
|
|
||||||
PTRACE_KILL = C.PT_KILL
|
|
||||||
PTRACE_LWPEVENTS = C.PT_LWP_EVENTS
|
|
||||||
PTRACE_LWPINFO = C.PT_LWPINFO
|
|
||||||
PTRACE_SETFPREGS = C.PT_SETFPREGS
|
|
||||||
PTRACE_SETREGS = C.PT_SETREGS
|
|
||||||
PTRACE_SINGLESTEP = C.PT_STEP
|
|
||||||
PTRACE_TRACEME = C.PT_TRACE_ME
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
PIOD_READ_D = C.PIOD_READ_D
|
|
||||||
PIOD_WRITE_D = C.PIOD_WRITE_D
|
|
||||||
PIOD_READ_I = C.PIOD_READ_I
|
|
||||||
PIOD_WRITE_I = C.PIOD_WRITE_I
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
PL_FLAG_BORN = C.PL_FLAG_BORN
|
|
||||||
PL_FLAG_EXITED = C.PL_FLAG_EXITED
|
|
||||||
PL_FLAG_SI = C.PL_FLAG_SI
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
TRAP_BRKPT = C.TRAP_BRKPT
|
|
||||||
TRAP_TRACE = C.TRAP_TRACE
|
|
||||||
)
|
|
||||||
|
|
||||||
type PtraceLwpInfoStruct C.struct_ptrace_lwpinfo
|
|
||||||
|
|
||||||
type __Siginfo C.struct___siginfo
|
|
||||||
|
|
||||||
type Sigset_t C.sigset_t
|
|
||||||
|
|
||||||
type Reg C.struct_reg
|
|
||||||
|
|
||||||
type FpReg C.struct_fpreg
|
|
||||||
|
|
||||||
type PtraceIoDesc C.struct_ptrace_io_desc
|
|
||||||
|
|
||||||
// Events (kqueue, kevent)
|
|
||||||
|
|
||||||
type Kevent_t C.struct_kevent_freebsd11
|
|
||||||
|
|
||||||
// Select
|
|
||||||
|
|
||||||
type FdSet C.fd_set
|
|
||||||
|
|
||||||
// Routing and interface messages
|
|
||||||
|
|
||||||
const (
|
|
||||||
sizeofIfMsghdr = C.sizeof_struct_if_msghdr
|
|
||||||
SizeofIfMsghdr = C.sizeof_struct_if_msghdr8
|
|
||||||
sizeofIfData = C.sizeof_struct_if_data
|
|
||||||
SizeofIfData = C.sizeof_struct_if_data8
|
|
||||||
SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
|
|
||||||
SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
|
|
||||||
SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
|
|
||||||
SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
|
|
||||||
SizeofRtMetrics = C.sizeof_struct_rt_metrics
|
|
||||||
)
|
|
||||||
|
|
||||||
type ifMsghdr C.struct_if_msghdr
|
|
||||||
|
|
||||||
type IfMsghdr C.struct_if_msghdr8
|
|
||||||
|
|
||||||
type ifData C.struct_if_data
|
|
||||||
|
|
||||||
type IfData C.struct_if_data8
|
|
||||||
|
|
||||||
type IfaMsghdr C.struct_ifa_msghdr
|
|
||||||
|
|
||||||
type IfmaMsghdr C.struct_ifma_msghdr
|
|
||||||
|
|
||||||
type IfAnnounceMsghdr C.struct_if_announcemsghdr
|
|
||||||
|
|
||||||
type RtMsghdr C.struct_rt_msghdr
|
|
||||||
|
|
||||||
type RtMetrics C.struct_rt_metrics
|
|
||||||
|
|
||||||
// Berkeley packet filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofBpfVersion = C.sizeof_struct_bpf_version
|
|
||||||
SizeofBpfStat = C.sizeof_struct_bpf_stat
|
|
||||||
SizeofBpfZbuf = C.sizeof_struct_bpf_zbuf
|
|
||||||
SizeofBpfProgram = C.sizeof_struct_bpf_program
|
|
||||||
SizeofBpfInsn = C.sizeof_struct_bpf_insn
|
|
||||||
SizeofBpfHdr = C.sizeof_struct_bpf_hdr
|
|
||||||
SizeofBpfZbufHeader = C.sizeof_struct_bpf_zbuf_header
|
|
||||||
)
|
|
||||||
|
|
||||||
type BpfVersion C.struct_bpf_version
|
|
||||||
|
|
||||||
type BpfStat C.struct_bpf_stat
|
|
||||||
|
|
||||||
type BpfZbuf C.struct_bpf_zbuf
|
|
||||||
|
|
||||||
type BpfProgram C.struct_bpf_program
|
|
||||||
|
|
||||||
type BpfInsn C.struct_bpf_insn
|
|
||||||
|
|
||||||
type BpfHdr C.struct_bpf_hdr
|
|
||||||
|
|
||||||
type BpfZbufHeader C.struct_bpf_zbuf_header
|
|
||||||
|
|
||||||
// Terminal handling
|
|
||||||
|
|
||||||
type Termios C.struct_termios
|
|
||||||
|
|
||||||
type Winsize C.struct_winsize
|
|
||||||
|
|
||||||
// fchmodat-like syscalls.
|
|
||||||
|
|
||||||
const (
|
|
||||||
AT_FDCWD = C.AT_FDCWD
|
|
||||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
|
||||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
|
||||||
)
|
|
||||||
|
|
||||||
// poll
|
|
||||||
|
|
||||||
type PollFd C.struct_pollfd
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLINIGNEOF = C.POLLINIGNEOF
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLRDBAND = C.POLLRDBAND
|
|
||||||
POLLRDNORM = C.POLLRDNORM
|
|
||||||
POLLWRBAND = C.POLLWRBAND
|
|
||||||
POLLWRNORM = C.POLLWRNORM
|
|
||||||
)
|
|
||||||
|
|
||||||
// Capabilities
|
|
||||||
|
|
||||||
type CapRights C.struct_cap_rights
|
|
||||||
|
|
||||||
// Uname
|
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
|
290
vendor/golang.org/x/sys/unix/types_netbsd.go
generated
vendored
290
vendor/golang.org/x/sys/unix/types_netbsd.go
generated
vendored
|
@ -1,290 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
Input to cgo -godefs. See README.md
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
|
||||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define KERNEL
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/event.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <sys/ptrace.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/signal.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <net/bpf.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
sizeofPtr = sizeof(void*),
|
|
||||||
};
|
|
||||||
|
|
||||||
union sockaddr_all {
|
|
||||||
struct sockaddr s1; // this one gets used for fields
|
|
||||||
struct sockaddr_in s2; // these pad it out
|
|
||||||
struct sockaddr_in6 s3;
|
|
||||||
struct sockaddr_un s4;
|
|
||||||
struct sockaddr_dl s5;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_any {
|
|
||||||
struct sockaddr addr;
|
|
||||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
// Machine characteristics
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofPtr = C.sizeofPtr
|
|
||||||
SizeofShort = C.sizeof_short
|
|
||||||
SizeofInt = C.sizeof_int
|
|
||||||
SizeofLong = C.sizeof_long
|
|
||||||
SizeofLongLong = C.sizeof_longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Basic types
|
|
||||||
|
|
||||||
type (
|
|
||||||
_C_short C.short
|
|
||||||
_C_int C.int
|
|
||||||
_C_long C.long
|
|
||||||
_C_long_long C.longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Time
|
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
|
||||||
|
|
||||||
// Processes
|
|
||||||
|
|
||||||
type Rusage C.struct_rusage
|
|
||||||
|
|
||||||
type Rlimit C.struct_rlimit
|
|
||||||
|
|
||||||
type _Gid_t C.gid_t
|
|
||||||
|
|
||||||
// Files
|
|
||||||
|
|
||||||
type Stat_t C.struct_stat
|
|
||||||
|
|
||||||
type Statfs_t C.struct_statfs
|
|
||||||
|
|
||||||
type Flock_t C.struct_flock
|
|
||||||
|
|
||||||
type Dirent C.struct_dirent
|
|
||||||
|
|
||||||
type Fsid C.fsid_t
|
|
||||||
|
|
||||||
// File system limits
|
|
||||||
|
|
||||||
const (
|
|
||||||
PathMax = C.PATH_MAX
|
|
||||||
)
|
|
||||||
|
|
||||||
// Advice to Fadvise
|
|
||||||
|
|
||||||
const (
|
|
||||||
FADV_NORMAL = C.POSIX_FADV_NORMAL
|
|
||||||
FADV_RANDOM = C.POSIX_FADV_RANDOM
|
|
||||||
FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
|
|
||||||
FADV_WILLNEED = C.POSIX_FADV_WILLNEED
|
|
||||||
FADV_DONTNEED = C.POSIX_FADV_DONTNEED
|
|
||||||
FADV_NOREUSE = C.POSIX_FADV_NOREUSE
|
|
||||||
)
|
|
||||||
|
|
||||||
// Sockets
|
|
||||||
|
|
||||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
|
||||||
|
|
||||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
|
||||||
|
|
||||||
type RawSockaddrDatalink C.struct_sockaddr_dl
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
|
||||||
|
|
||||||
type _Socklen C.socklen_t
|
|
||||||
|
|
||||||
type Linger C.struct_linger
|
|
||||||
|
|
||||||
type Iovec C.struct_iovec
|
|
||||||
|
|
||||||
type IPMreq C.struct_ip_mreq
|
|
||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
|
||||||
|
|
||||||
type Inet6Pktinfo C.struct_in6_pktinfo
|
|
||||||
|
|
||||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
|
||||||
|
|
||||||
type ICMPv6Filter C.struct_icmp6_filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
|
||||||
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
|
||||||
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
|
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
// Ptrace requests
|
|
||||||
|
|
||||||
const (
|
|
||||||
PTRACE_TRACEME = C.PT_TRACE_ME
|
|
||||||
PTRACE_CONT = C.PT_CONTINUE
|
|
||||||
PTRACE_KILL = C.PT_KILL
|
|
||||||
)
|
|
||||||
|
|
||||||
// Events (kqueue, kevent)
|
|
||||||
|
|
||||||
type Kevent_t C.struct_kevent
|
|
||||||
|
|
||||||
// Select
|
|
||||||
|
|
||||||
type FdSet C.fd_set
|
|
||||||
|
|
||||||
// Routing and interface messages
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofIfMsghdr = C.sizeof_struct_if_msghdr
|
|
||||||
SizeofIfData = C.sizeof_struct_if_data
|
|
||||||
SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
|
|
||||||
SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
|
|
||||||
SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
|
|
||||||
SizeofRtMetrics = C.sizeof_struct_rt_metrics
|
|
||||||
)
|
|
||||||
|
|
||||||
type IfMsghdr C.struct_if_msghdr
|
|
||||||
|
|
||||||
type IfData C.struct_if_data
|
|
||||||
|
|
||||||
type IfaMsghdr C.struct_ifa_msghdr
|
|
||||||
|
|
||||||
type IfAnnounceMsghdr C.struct_if_announcemsghdr
|
|
||||||
|
|
||||||
type RtMsghdr C.struct_rt_msghdr
|
|
||||||
|
|
||||||
type RtMetrics C.struct_rt_metrics
|
|
||||||
|
|
||||||
type Mclpool C.struct_mclpool
|
|
||||||
|
|
||||||
// Berkeley packet filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofBpfVersion = C.sizeof_struct_bpf_version
|
|
||||||
SizeofBpfStat = C.sizeof_struct_bpf_stat
|
|
||||||
SizeofBpfProgram = C.sizeof_struct_bpf_program
|
|
||||||
SizeofBpfInsn = C.sizeof_struct_bpf_insn
|
|
||||||
SizeofBpfHdr = C.sizeof_struct_bpf_hdr
|
|
||||||
)
|
|
||||||
|
|
||||||
type BpfVersion C.struct_bpf_version
|
|
||||||
|
|
||||||
type BpfStat C.struct_bpf_stat
|
|
||||||
|
|
||||||
type BpfProgram C.struct_bpf_program
|
|
||||||
|
|
||||||
type BpfInsn C.struct_bpf_insn
|
|
||||||
|
|
||||||
type BpfHdr C.struct_bpf_hdr
|
|
||||||
|
|
||||||
type BpfTimeval C.struct_bpf_timeval
|
|
||||||
|
|
||||||
// Terminal handling
|
|
||||||
|
|
||||||
type Termios C.struct_termios
|
|
||||||
|
|
||||||
type Winsize C.struct_winsize
|
|
||||||
|
|
||||||
type Ptmget C.struct_ptmget
|
|
||||||
|
|
||||||
// fchmodat-like syscalls.
|
|
||||||
|
|
||||||
const (
|
|
||||||
AT_FDCWD = C.AT_FDCWD
|
|
||||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
|
||||||
)
|
|
||||||
|
|
||||||
// poll
|
|
||||||
|
|
||||||
type PollFd C.struct_pollfd
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLRDBAND = C.POLLRDBAND
|
|
||||||
POLLRDNORM = C.POLLRDNORM
|
|
||||||
POLLWRBAND = C.POLLWRBAND
|
|
||||||
POLLWRNORM = C.POLLWRNORM
|
|
||||||
)
|
|
||||||
|
|
||||||
// Sysctl
|
|
||||||
|
|
||||||
type Sysctlnode C.struct_sysctlnode
|
|
||||||
|
|
||||||
// Uname
|
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
|
||||||
|
|
||||||
// Clockinfo
|
|
||||||
|
|
||||||
const SizeofClockinfo = C.sizeof_struct_clockinfo
|
|
||||||
|
|
||||||
type Clockinfo C.struct_clockinfo
|
|
283
vendor/golang.org/x/sys/unix/types_openbsd.go
generated
vendored
283
vendor/golang.org/x/sys/unix/types_openbsd.go
generated
vendored
|
@ -1,283 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
Input to cgo -godefs. See README.md
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
|
||||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define KERNEL
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/event.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <sys/ptrace.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/signal.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <uvm/uvmexp.h>
|
|
||||||
#include <net/bpf.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
sizeofPtr = sizeof(void*),
|
|
||||||
};
|
|
||||||
|
|
||||||
union sockaddr_all {
|
|
||||||
struct sockaddr s1; // this one gets used for fields
|
|
||||||
struct sockaddr_in s2; // these pad it out
|
|
||||||
struct sockaddr_in6 s3;
|
|
||||||
struct sockaddr_un s4;
|
|
||||||
struct sockaddr_dl s5;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_any {
|
|
||||||
struct sockaddr addr;
|
|
||||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
// Machine characteristics
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofPtr = C.sizeofPtr
|
|
||||||
SizeofShort = C.sizeof_short
|
|
||||||
SizeofInt = C.sizeof_int
|
|
||||||
SizeofLong = C.sizeof_long
|
|
||||||
SizeofLongLong = C.sizeof_longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Basic types
|
|
||||||
|
|
||||||
type (
|
|
||||||
_C_short C.short
|
|
||||||
_C_int C.int
|
|
||||||
_C_long C.long
|
|
||||||
_C_long_long C.longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Time
|
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
|
||||||
|
|
||||||
// Processes
|
|
||||||
|
|
||||||
type Rusage C.struct_rusage
|
|
||||||
|
|
||||||
type Rlimit C.struct_rlimit
|
|
||||||
|
|
||||||
type _Gid_t C.gid_t
|
|
||||||
|
|
||||||
// Files
|
|
||||||
|
|
||||||
type Stat_t C.struct_stat
|
|
||||||
|
|
||||||
type Statfs_t C.struct_statfs
|
|
||||||
|
|
||||||
type Flock_t C.struct_flock
|
|
||||||
|
|
||||||
type Dirent C.struct_dirent
|
|
||||||
|
|
||||||
type Fsid C.fsid_t
|
|
||||||
|
|
||||||
// File system limits
|
|
||||||
|
|
||||||
const (
|
|
||||||
PathMax = C.PATH_MAX
|
|
||||||
)
|
|
||||||
|
|
||||||
// Sockets
|
|
||||||
|
|
||||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
|
||||||
|
|
||||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
|
||||||
|
|
||||||
type RawSockaddrDatalink C.struct_sockaddr_dl
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
|
||||||
|
|
||||||
type _Socklen C.socklen_t
|
|
||||||
|
|
||||||
type Linger C.struct_linger
|
|
||||||
|
|
||||||
type Iovec C.struct_iovec
|
|
||||||
|
|
||||||
type IPMreq C.struct_ip_mreq
|
|
||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
|
||||||
|
|
||||||
type Inet6Pktinfo C.struct_in6_pktinfo
|
|
||||||
|
|
||||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
|
||||||
|
|
||||||
type ICMPv6Filter C.struct_icmp6_filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
|
||||||
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
|
||||||
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
|
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
// Ptrace requests
|
|
||||||
|
|
||||||
const (
|
|
||||||
PTRACE_TRACEME = C.PT_TRACE_ME
|
|
||||||
PTRACE_CONT = C.PT_CONTINUE
|
|
||||||
PTRACE_KILL = C.PT_KILL
|
|
||||||
)
|
|
||||||
|
|
||||||
// Events (kqueue, kevent)
|
|
||||||
|
|
||||||
type Kevent_t C.struct_kevent
|
|
||||||
|
|
||||||
// Select
|
|
||||||
|
|
||||||
type FdSet C.fd_set
|
|
||||||
|
|
||||||
// Routing and interface messages
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofIfMsghdr = C.sizeof_struct_if_msghdr
|
|
||||||
SizeofIfData = C.sizeof_struct_if_data
|
|
||||||
SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
|
|
||||||
SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
|
|
||||||
SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
|
|
||||||
SizeofRtMetrics = C.sizeof_struct_rt_metrics
|
|
||||||
)
|
|
||||||
|
|
||||||
type IfMsghdr C.struct_if_msghdr
|
|
||||||
|
|
||||||
type IfData C.struct_if_data
|
|
||||||
|
|
||||||
type IfaMsghdr C.struct_ifa_msghdr
|
|
||||||
|
|
||||||
type IfAnnounceMsghdr C.struct_if_announcemsghdr
|
|
||||||
|
|
||||||
type RtMsghdr C.struct_rt_msghdr
|
|
||||||
|
|
||||||
type RtMetrics C.struct_rt_metrics
|
|
||||||
|
|
||||||
type Mclpool C.struct_mclpool
|
|
||||||
|
|
||||||
// Berkeley packet filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofBpfVersion = C.sizeof_struct_bpf_version
|
|
||||||
SizeofBpfStat = C.sizeof_struct_bpf_stat
|
|
||||||
SizeofBpfProgram = C.sizeof_struct_bpf_program
|
|
||||||
SizeofBpfInsn = C.sizeof_struct_bpf_insn
|
|
||||||
SizeofBpfHdr = C.sizeof_struct_bpf_hdr
|
|
||||||
)
|
|
||||||
|
|
||||||
type BpfVersion C.struct_bpf_version
|
|
||||||
|
|
||||||
type BpfStat C.struct_bpf_stat
|
|
||||||
|
|
||||||
type BpfProgram C.struct_bpf_program
|
|
||||||
|
|
||||||
type BpfInsn C.struct_bpf_insn
|
|
||||||
|
|
||||||
type BpfHdr C.struct_bpf_hdr
|
|
||||||
|
|
||||||
type BpfTimeval C.struct_bpf_timeval
|
|
||||||
|
|
||||||
// Terminal handling
|
|
||||||
|
|
||||||
type Termios C.struct_termios
|
|
||||||
|
|
||||||
type Winsize C.struct_winsize
|
|
||||||
|
|
||||||
// fchmodat-like syscalls.
|
|
||||||
|
|
||||||
const (
|
|
||||||
AT_FDCWD = C.AT_FDCWD
|
|
||||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
|
||||||
)
|
|
||||||
|
|
||||||
// poll
|
|
||||||
|
|
||||||
type PollFd C.struct_pollfd
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLRDBAND = C.POLLRDBAND
|
|
||||||
POLLRDNORM = C.POLLRDNORM
|
|
||||||
POLLWRBAND = C.POLLWRBAND
|
|
||||||
POLLWRNORM = C.POLLWRNORM
|
|
||||||
)
|
|
||||||
|
|
||||||
// Signal Sets
|
|
||||||
|
|
||||||
type Sigset_t C.sigset_t
|
|
||||||
|
|
||||||
// Uname
|
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
|
||||||
|
|
||||||
// Uvmexp
|
|
||||||
|
|
||||||
const SizeofUvmexp = C.sizeof_struct_uvmexp
|
|
||||||
|
|
||||||
type Uvmexp C.struct_uvmexp
|
|
||||||
|
|
||||||
// Clockinfo
|
|
||||||
|
|
||||||
const SizeofClockinfo = C.sizeof_struct_clockinfo
|
|
||||||
|
|
||||||
type Clockinfo C.struct_clockinfo
|
|
266
vendor/golang.org/x/sys/unix/types_solaris.go
generated
vendored
266
vendor/golang.org/x/sys/unix/types_solaris.go
generated
vendored
|
@ -1,266 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
/*
|
|
||||||
Input to cgo -godefs. See README.md
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
|
||||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define KERNEL
|
|
||||||
// These defines ensure that builds done on newer versions of Solaris are
|
|
||||||
// backwards-compatible with older versions of Solaris and
|
|
||||||
// OpenSolaris-based derivatives.
|
|
||||||
#define __USE_SUNOS_SOCKETS__ // msghdr
|
|
||||||
#define __USE_LEGACY_PROTOTYPES__ // iovec
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <termio.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/signal.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/statvfs.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/times.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <net/bpf.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
#include <ustat.h>
|
|
||||||
#include <utime.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
sizeofPtr = sizeof(void*),
|
|
||||||
};
|
|
||||||
|
|
||||||
union sockaddr_all {
|
|
||||||
struct sockaddr s1; // this one gets used for fields
|
|
||||||
struct sockaddr_in s2; // these pad it out
|
|
||||||
struct sockaddr_in6 s3;
|
|
||||||
struct sockaddr_un s4;
|
|
||||||
struct sockaddr_dl s5;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_any {
|
|
||||||
struct sockaddr addr;
|
|
||||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
// Machine characteristics
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofPtr = C.sizeofPtr
|
|
||||||
SizeofShort = C.sizeof_short
|
|
||||||
SizeofInt = C.sizeof_int
|
|
||||||
SizeofLong = C.sizeof_long
|
|
||||||
SizeofLongLong = C.sizeof_longlong
|
|
||||||
PathMax = C.PATH_MAX
|
|
||||||
MaxHostNameLen = C.MAXHOSTNAMELEN
|
|
||||||
)
|
|
||||||
|
|
||||||
// Basic types
|
|
||||||
|
|
||||||
type (
|
|
||||||
_C_short C.short
|
|
||||||
_C_int C.int
|
|
||||||
_C_long C.long
|
|
||||||
_C_long_long C.longlong
|
|
||||||
)
|
|
||||||
|
|
||||||
// Time
|
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
|
||||||
|
|
||||||
type Timeval32 C.struct_timeval32
|
|
||||||
|
|
||||||
type Tms C.struct_tms
|
|
||||||
|
|
||||||
type Utimbuf C.struct_utimbuf
|
|
||||||
|
|
||||||
// Processes
|
|
||||||
|
|
||||||
type Rusage C.struct_rusage
|
|
||||||
|
|
||||||
type Rlimit C.struct_rlimit
|
|
||||||
|
|
||||||
type _Gid_t C.gid_t
|
|
||||||
|
|
||||||
// Files
|
|
||||||
|
|
||||||
type Stat_t C.struct_stat
|
|
||||||
|
|
||||||
type Flock_t C.struct_flock
|
|
||||||
|
|
||||||
type Dirent C.struct_dirent
|
|
||||||
|
|
||||||
// Filesystems
|
|
||||||
|
|
||||||
type _Fsblkcnt_t C.fsblkcnt_t
|
|
||||||
|
|
||||||
type Statvfs_t C.struct_statvfs
|
|
||||||
|
|
||||||
// Sockets
|
|
||||||
|
|
||||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
|
||||||
|
|
||||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
|
||||||
|
|
||||||
type RawSockaddrDatalink C.struct_sockaddr_dl
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
|
||||||
|
|
||||||
type _Socklen C.socklen_t
|
|
||||||
|
|
||||||
type Linger C.struct_linger
|
|
||||||
|
|
||||||
type Iovec C.struct_iovec
|
|
||||||
|
|
||||||
type IPMreq C.struct_ip_mreq
|
|
||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
|
||||||
|
|
||||||
type Inet6Pktinfo C.struct_in6_pktinfo
|
|
||||||
|
|
||||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
|
||||||
|
|
||||||
type ICMPv6Filter C.struct_icmp6_filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
|
||||||
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
|
||||||
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
|
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
// Select
|
|
||||||
|
|
||||||
type FdSet C.fd_set
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
|
||||||
|
|
||||||
type Ustat_t C.struct_ustat
|
|
||||||
|
|
||||||
const (
|
|
||||||
AT_FDCWD = C.AT_FDCWD
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
|
||||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
|
||||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
|
||||||
AT_EACCESS = C.AT_EACCESS
|
|
||||||
)
|
|
||||||
|
|
||||||
// Routing and interface messages
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofIfMsghdr = C.sizeof_struct_if_msghdr
|
|
||||||
SizeofIfData = C.sizeof_struct_if_data
|
|
||||||
SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
|
|
||||||
SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
|
|
||||||
SizeofRtMetrics = C.sizeof_struct_rt_metrics
|
|
||||||
)
|
|
||||||
|
|
||||||
type IfMsghdr C.struct_if_msghdr
|
|
||||||
|
|
||||||
type IfData C.struct_if_data
|
|
||||||
|
|
||||||
type IfaMsghdr C.struct_ifa_msghdr
|
|
||||||
|
|
||||||
type RtMsghdr C.struct_rt_msghdr
|
|
||||||
|
|
||||||
type RtMetrics C.struct_rt_metrics
|
|
||||||
|
|
||||||
// Berkeley packet filter
|
|
||||||
|
|
||||||
const (
|
|
||||||
SizeofBpfVersion = C.sizeof_struct_bpf_version
|
|
||||||
SizeofBpfStat = C.sizeof_struct_bpf_stat
|
|
||||||
SizeofBpfProgram = C.sizeof_struct_bpf_program
|
|
||||||
SizeofBpfInsn = C.sizeof_struct_bpf_insn
|
|
||||||
SizeofBpfHdr = C.sizeof_struct_bpf_hdr
|
|
||||||
)
|
|
||||||
|
|
||||||
type BpfVersion C.struct_bpf_version
|
|
||||||
|
|
||||||
type BpfStat C.struct_bpf_stat
|
|
||||||
|
|
||||||
type BpfProgram C.struct_bpf_program
|
|
||||||
|
|
||||||
type BpfInsn C.struct_bpf_insn
|
|
||||||
|
|
||||||
type BpfTimeval C.struct_bpf_timeval
|
|
||||||
|
|
||||||
type BpfHdr C.struct_bpf_hdr
|
|
||||||
|
|
||||||
// Terminal handling
|
|
||||||
|
|
||||||
type Termios C.struct_termios
|
|
||||||
|
|
||||||
type Termio C.struct_termio
|
|
||||||
|
|
||||||
type Winsize C.struct_winsize
|
|
||||||
|
|
||||||
// poll
|
|
||||||
|
|
||||||
type PollFd C.struct_pollfd
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLRDBAND = C.POLLRDBAND
|
|
||||||
POLLRDNORM = C.POLLRDNORM
|
|
||||||
POLLWRBAND = C.POLLWRBAND
|
|
||||||
POLLWRNORM = C.POLLWRNORM
|
|
||||||
)
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
|
@ -722,6 +722,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -987,6 +988,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
|
@ -722,6 +722,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -987,6 +988,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
|
@ -724,6 +724,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -989,6 +990,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
|
@ -721,6 +721,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x0
|
F_RDLCK = 0x0
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -986,6 +987,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
|
@ -725,6 +725,7 @@ const (
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
F_RDLCK = 0x1
|
F_RDLCK = 0x1
|
||||||
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
F_SEAL_SHRINK = 0x2
|
F_SEAL_SHRINK = 0x2
|
||||||
|
@ -990,6 +991,7 @@ const (
|
||||||
IPV6_RECVRTHDR = 0x38
|
IPV6_RECVRTHDR = 0x38
|
||||||
IPV6_RECVTCLASS = 0x42
|
IPV6_RECVTCLASS = 0x42
|
||||||
IPV6_ROUTER_ALERT = 0x16
|
IPV6_ROUTER_ALERT = 0x16
|
||||||
|
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
|
||||||
IPV6_RTHDR = 0x39
|
IPV6_RTHDR = 0x39
|
||||||
IPV6_RTHDRDSTOPTS = 0x37
|
IPV6_RTHDRDSTOPTS = 0x37
|
||||||
IPV6_RTHDR_LOOSE = 0x0
|
IPV6_RTHDR_LOOSE = 0x0
|
||||||
|
|
20
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go
generated
vendored
20
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go
generated
vendored
|
@ -377,16 +377,6 @@ func Munlockall() (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
|
||||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
||||||
_, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
_, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
@ -1691,6 +1681,16 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) {
|
func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) {
|
||||||
r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
|
r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
|
||||||
sec = int32(r0)
|
sec = int32(r0)
|
||||||
|
|
30
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
generated
vendored
30
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
generated
vendored
|
@ -527,21 +527,6 @@ func libc_munlockall_trampoline()
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func libc_ptrace_trampoline()
|
|
||||||
|
|
||||||
//go:linkname libc_ptrace libc_ptrace
|
|
||||||
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
@ -2341,6 +2326,21 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||||
|
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func libc_ptrace_trampoline()
|
||||||
|
|
||||||
|
//go:linkname libc_ptrace libc_ptrace
|
||||||
|
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) {
|
func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) {
|
||||||
r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0)
|
r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0)
|
||||||
sec = int32(r0)
|
sec = int32(r0)
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s
generated
vendored
4
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s
generated
vendored
|
@ -64,8 +64,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlock(SB)
|
JMP libc_munlock(SB)
|
||||||
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlockall(SB)
|
JMP libc_munlockall(SB)
|
||||||
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
|
||||||
JMP libc_ptrace(SB)
|
|
||||||
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_getattrlist(SB)
|
JMP libc_getattrlist(SB)
|
||||||
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
@ -264,6 +262,8 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_mmap(SB)
|
JMP libc_mmap(SB)
|
||||||
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munmap(SB)
|
JMP libc_munmap(SB)
|
||||||
|
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_ptrace(SB)
|
||||||
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_gettimeofday(SB)
|
JMP libc_gettimeofday(SB)
|
||||||
TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
|
30
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
generated
vendored
30
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
generated
vendored
|
@ -527,21 +527,6 @@ func libc_munlockall_trampoline()
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func libc_ptrace_trampoline()
|
|
||||||
|
|
||||||
//go:linkname libc_ptrace libc_ptrace
|
|
||||||
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
@ -2356,6 +2341,21 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||||
|
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func libc_ptrace_trampoline()
|
||||||
|
|
||||||
|
//go:linkname libc_ptrace libc_ptrace
|
||||||
|
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) {
|
func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) {
|
||||||
r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0)
|
r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0)
|
||||||
sec = int64(r0)
|
sec = int64(r0)
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
generated
vendored
4
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
generated
vendored
|
@ -64,8 +64,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlock(SB)
|
JMP libc_munlock(SB)
|
||||||
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlockall(SB)
|
JMP libc_munlockall(SB)
|
||||||
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
|
||||||
JMP libc_ptrace(SB)
|
|
||||||
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_getattrlist(SB)
|
JMP libc_getattrlist(SB)
|
||||||
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
@ -266,6 +264,8 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_mmap(SB)
|
JMP libc_mmap(SB)
|
||||||
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munmap(SB)
|
JMP libc_munmap(SB)
|
||||||
|
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_ptrace(SB)
|
||||||
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_gettimeofday(SB)
|
JMP libc_gettimeofday(SB)
|
||||||
TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
|
15
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
generated
vendored
15
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
generated
vendored
|
@ -527,21 +527,6 @@ func libc_munlockall_trampoline()
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func libc_ptrace_trampoline()
|
|
||||||
|
|
||||||
//go:linkname libc_ptrace libc_ptrace
|
|
||||||
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s
generated
vendored
2
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s
generated
vendored
|
@ -64,8 +64,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlock(SB)
|
JMP libc_munlock(SB)
|
||||||
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlockall(SB)
|
JMP libc_munlockall(SB)
|
||||||
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
|
||||||
JMP libc_ptrace(SB)
|
|
||||||
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_getattrlist(SB)
|
JMP libc_getattrlist(SB)
|
||||||
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
|
15
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
generated
vendored
15
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
generated
vendored
|
@ -527,21 +527,6 @@ func libc_munlockall_trampoline()
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func libc_ptrace_trampoline()
|
|
||||||
|
|
||||||
//go:linkname libc_ptrace libc_ptrace
|
|
||||||
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
|
||||||
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
generated
vendored
2
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
generated
vendored
|
@ -64,8 +64,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlock(SB)
|
JMP libc_munlock(SB)
|
||||||
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_munlockall(SB)
|
JMP libc_munlockall(SB)
|
||||||
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
|
||||||
JMP libc_ptrace(SB)
|
|
||||||
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
||||||
JMP libc_getattrlist(SB)
|
JMP libc_getattrlist(SB)
|
||||||
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
generated
vendored
|
@ -808,6 +808,7 @@ type Ustat_t struct {
|
||||||
|
|
||||||
type EpollEvent struct {
|
type EpollEvent struct {
|
||||||
Events uint32
|
Events uint32
|
||||||
|
_ int32
|
||||||
Fd int32
|
Fd int32
|
||||||
Pad int32
|
Pad int32
|
||||||
}
|
}
|
||||||
|
|
4
vendor/golang.org/x/sys/windows/service.go
generated
vendored
4
vendor/golang.org/x/sys/windows/service.go
generated
vendored
|
@ -159,6 +159,10 @@ type SERVICE_DESCRIPTION struct {
|
||||||
Description *uint16
|
Description *uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SERVICE_DELAYED_AUTO_START_INFO struct {
|
||||||
|
IsDelayedAutoStartUp uint32
|
||||||
|
}
|
||||||
|
|
||||||
type SERVICE_STATUS_PROCESS struct {
|
type SERVICE_STATUS_PROCESS struct {
|
||||||
ServiceType uint32
|
ServiceType uint32
|
||||||
CurrentState uint32
|
CurrentState uint32
|
||||||
|
|
133
vendor/golang.org/x/text/unicode/bidi/gen.go
generated
vendored
133
vendor/golang.org/x/text/unicode/bidi/gen.go
generated
vendored
|
@ -1,133 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"flag"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"golang.org/x/text/internal/gen"
|
|
||||||
"golang.org/x/text/internal/triegen"
|
|
||||||
"golang.org/x/text/internal/ucd"
|
|
||||||
)
|
|
||||||
|
|
||||||
var outputFile = flag.String("out", "tables.go", "output file")
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
gen.Init()
|
|
||||||
gen.Repackage("gen_trieval.go", "trieval.go", "bidi")
|
|
||||||
gen.Repackage("gen_ranges.go", "ranges_test.go", "bidi")
|
|
||||||
|
|
||||||
genTables()
|
|
||||||
}
|
|
||||||
|
|
||||||
// bidiClass names and codes taken from class "bc" in
|
|
||||||
// http://www.unicode.org/Public/8.0.0/ucd/PropertyValueAliases.txt
|
|
||||||
var bidiClass = map[string]Class{
|
|
||||||
"AL": AL, // ArabicLetter
|
|
||||||
"AN": AN, // ArabicNumber
|
|
||||||
"B": B, // ParagraphSeparator
|
|
||||||
"BN": BN, // BoundaryNeutral
|
|
||||||
"CS": CS, // CommonSeparator
|
|
||||||
"EN": EN, // EuropeanNumber
|
|
||||||
"ES": ES, // EuropeanSeparator
|
|
||||||
"ET": ET, // EuropeanTerminator
|
|
||||||
"L": L, // LeftToRight
|
|
||||||
"NSM": NSM, // NonspacingMark
|
|
||||||
"ON": ON, // OtherNeutral
|
|
||||||
"R": R, // RightToLeft
|
|
||||||
"S": S, // SegmentSeparator
|
|
||||||
"WS": WS, // WhiteSpace
|
|
||||||
|
|
||||||
"FSI": Control,
|
|
||||||
"PDF": Control,
|
|
||||||
"PDI": Control,
|
|
||||||
"LRE": Control,
|
|
||||||
"LRI": Control,
|
|
||||||
"LRO": Control,
|
|
||||||
"RLE": Control,
|
|
||||||
"RLI": Control,
|
|
||||||
"RLO": Control,
|
|
||||||
}
|
|
||||||
|
|
||||||
func genTables() {
|
|
||||||
if numClass > 0x0F {
|
|
||||||
log.Fatalf("Too many Class constants (%#x > 0x0F).", numClass)
|
|
||||||
}
|
|
||||||
w := gen.NewCodeWriter()
|
|
||||||
defer w.WriteVersionedGoFile(*outputFile, "bidi")
|
|
||||||
|
|
||||||
gen.WriteUnicodeVersion(w)
|
|
||||||
|
|
||||||
t := triegen.NewTrie("bidi")
|
|
||||||
|
|
||||||
// Build data about bracket mapping. These bits need to be or-ed with
|
|
||||||
// any other bits.
|
|
||||||
orMask := map[rune]uint64{}
|
|
||||||
|
|
||||||
xorMap := map[rune]int{}
|
|
||||||
xorMasks := []rune{0} // First value is no-op.
|
|
||||||
|
|
||||||
ucd.Parse(gen.OpenUCDFile("BidiBrackets.txt"), func(p *ucd.Parser) {
|
|
||||||
r1 := p.Rune(0)
|
|
||||||
r2 := p.Rune(1)
|
|
||||||
xor := r1 ^ r2
|
|
||||||
if _, ok := xorMap[xor]; !ok {
|
|
||||||
xorMap[xor] = len(xorMasks)
|
|
||||||
xorMasks = append(xorMasks, xor)
|
|
||||||
}
|
|
||||||
entry := uint64(xorMap[xor]) << xorMaskShift
|
|
||||||
switch p.String(2) {
|
|
||||||
case "o":
|
|
||||||
entry |= openMask
|
|
||||||
case "c", "n":
|
|
||||||
default:
|
|
||||||
log.Fatalf("Unknown bracket class %q.", p.String(2))
|
|
||||||
}
|
|
||||||
orMask[r1] = entry
|
|
||||||
})
|
|
||||||
|
|
||||||
w.WriteComment(`
|
|
||||||
xorMasks contains masks to be xor-ed with brackets to get the reverse
|
|
||||||
version.`)
|
|
||||||
w.WriteVar("xorMasks", xorMasks)
|
|
||||||
|
|
||||||
done := map[rune]bool{}
|
|
||||||
|
|
||||||
insert := func(r rune, c Class) {
|
|
||||||
if !done[r] {
|
|
||||||
t.Insert(r, orMask[r]|uint64(c))
|
|
||||||
done[r] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the derived BiDi properties.
|
|
||||||
ucd.Parse(gen.OpenUCDFile("extracted/DerivedBidiClass.txt"), func(p *ucd.Parser) {
|
|
||||||
r := p.Rune(0)
|
|
||||||
class, ok := bidiClass[p.String(1)]
|
|
||||||
if !ok {
|
|
||||||
log.Fatalf("%U: Unknown BiDi class %q", r, p.String(1))
|
|
||||||
}
|
|
||||||
insert(r, class)
|
|
||||||
})
|
|
||||||
visitDefaults(insert)
|
|
||||||
|
|
||||||
// TODO: use sparse blocks. This would reduce table size considerably
|
|
||||||
// from the looks of it.
|
|
||||||
|
|
||||||
sz, err := t.Gen(w)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
w.Size += sz
|
|
||||||
}
|
|
||||||
|
|
||||||
// dummy values to make methods in gen_common compile. The real versions
|
|
||||||
// will be generated by this file to tables.go.
|
|
||||||
var (
|
|
||||||
xorMasks []rune
|
|
||||||
)
|
|
57
vendor/golang.org/x/text/unicode/bidi/gen_ranges.go
generated
vendored
57
vendor/golang.org/x/text/unicode/bidi/gen_ranges.go
generated
vendored
|
@ -1,57 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"unicode"
|
|
||||||
|
|
||||||
"golang.org/x/text/internal/gen"
|
|
||||||
"golang.org/x/text/internal/ucd"
|
|
||||||
"golang.org/x/text/unicode/rangetable"
|
|
||||||
)
|
|
||||||
|
|
||||||
// These tables are hand-extracted from:
|
|
||||||
// http://www.unicode.org/Public/8.0.0/ucd/extracted/DerivedBidiClass.txt
|
|
||||||
func visitDefaults(fn func(r rune, c Class)) {
|
|
||||||
// first write default values for ranges listed above.
|
|
||||||
visitRunes(fn, AL, []rune{
|
|
||||||
0x0600, 0x07BF, // Arabic
|
|
||||||
0x08A0, 0x08FF, // Arabic Extended-A
|
|
||||||
0xFB50, 0xFDCF, // Arabic Presentation Forms
|
|
||||||
0xFDF0, 0xFDFF,
|
|
||||||
0xFE70, 0xFEFF,
|
|
||||||
0x0001EE00, 0x0001EEFF, // Arabic Mathematical Alpha Symbols
|
|
||||||
})
|
|
||||||
visitRunes(fn, R, []rune{
|
|
||||||
0x0590, 0x05FF, // Hebrew
|
|
||||||
0x07C0, 0x089F, // Nko et al.
|
|
||||||
0xFB1D, 0xFB4F,
|
|
||||||
0x00010800, 0x00010FFF, // Cypriot Syllabary et. al.
|
|
||||||
0x0001E800, 0x0001EDFF,
|
|
||||||
0x0001EF00, 0x0001EFFF,
|
|
||||||
})
|
|
||||||
visitRunes(fn, ET, []rune{ // European Terminator
|
|
||||||
0x20A0, 0x20Cf, // Currency symbols
|
|
||||||
})
|
|
||||||
rangetable.Visit(unicode.Noncharacter_Code_Point, func(r rune) {
|
|
||||||
fn(r, BN) // Boundary Neutral
|
|
||||||
})
|
|
||||||
ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) {
|
|
||||||
if p.String(1) == "Default_Ignorable_Code_Point" {
|
|
||||||
fn(p.Rune(0), BN) // Boundary Neutral
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func visitRunes(fn func(r rune, c Class), c Class, runes []rune) {
|
|
||||||
for i := 0; i < len(runes); i += 2 {
|
|
||||||
lo, hi := runes[i], runes[i+1]
|
|
||||||
for j := lo; j <= hi; j++ {
|
|
||||||
fn(j, c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
64
vendor/golang.org/x/text/unicode/bidi/gen_trieval.go
generated
vendored
64
vendor/golang.org/x/text/unicode/bidi/gen_trieval.go
generated
vendored
|
@ -1,64 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
// Class is the Unicode BiDi class. Each rune has a single class.
|
|
||||||
type Class uint
|
|
||||||
|
|
||||||
const (
|
|
||||||
L Class = iota // LeftToRight
|
|
||||||
R // RightToLeft
|
|
||||||
EN // EuropeanNumber
|
|
||||||
ES // EuropeanSeparator
|
|
||||||
ET // EuropeanTerminator
|
|
||||||
AN // ArabicNumber
|
|
||||||
CS // CommonSeparator
|
|
||||||
B // ParagraphSeparator
|
|
||||||
S // SegmentSeparator
|
|
||||||
WS // WhiteSpace
|
|
||||||
ON // OtherNeutral
|
|
||||||
BN // BoundaryNeutral
|
|
||||||
NSM // NonspacingMark
|
|
||||||
AL // ArabicLetter
|
|
||||||
Control // Control LRO - PDI
|
|
||||||
|
|
||||||
numClass
|
|
||||||
|
|
||||||
LRO // LeftToRightOverride
|
|
||||||
RLO // RightToLeftOverride
|
|
||||||
LRE // LeftToRightEmbedding
|
|
||||||
RLE // RightToLeftEmbedding
|
|
||||||
PDF // PopDirectionalFormat
|
|
||||||
LRI // LeftToRightIsolate
|
|
||||||
RLI // RightToLeftIsolate
|
|
||||||
FSI // FirstStrongIsolate
|
|
||||||
PDI // PopDirectionalIsolate
|
|
||||||
|
|
||||||
unknownClass = ^Class(0)
|
|
||||||
)
|
|
||||||
|
|
||||||
var controlToClass = map[rune]Class{
|
|
||||||
0x202D: LRO, // LeftToRightOverride,
|
|
||||||
0x202E: RLO, // RightToLeftOverride,
|
|
||||||
0x202A: LRE, // LeftToRightEmbedding,
|
|
||||||
0x202B: RLE, // RightToLeftEmbedding,
|
|
||||||
0x202C: PDF, // PopDirectionalFormat,
|
|
||||||
0x2066: LRI, // LeftToRightIsolate,
|
|
||||||
0x2067: RLI, // RightToLeftIsolate,
|
|
||||||
0x2068: FSI, // FirstStrongIsolate,
|
|
||||||
0x2069: PDI, // PopDirectionalIsolate,
|
|
||||||
}
|
|
||||||
|
|
||||||
// A trie entry has the following bits:
|
|
||||||
// 7..5 XOR mask for brackets
|
|
||||||
// 4 1: Bracket open, 0: Bracket close
|
|
||||||
// 3..0 Class type
|
|
||||||
|
|
||||||
const (
|
|
||||||
openMask = 0x10
|
|
||||||
xorMaskShift = 5
|
|
||||||
)
|
|
976
vendor/golang.org/x/text/unicode/norm/maketables.go
generated
vendored
976
vendor/golang.org/x/text/unicode/norm/maketables.go
generated
vendored
|
@ -1,976 +0,0 @@
|
||||||
// Copyright 2011 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
// Normalization table generator.
|
|
||||||
// Data read from the web.
|
|
||||||
// See forminfo.go for a description of the trie values associated with each rune.
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"sort"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"golang.org/x/text/internal/gen"
|
|
||||||
"golang.org/x/text/internal/triegen"
|
|
||||||
"golang.org/x/text/internal/ucd"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
gen.Init()
|
|
||||||
loadUnicodeData()
|
|
||||||
compactCCC()
|
|
||||||
loadCompositionExclusions()
|
|
||||||
completeCharFields(FCanonical)
|
|
||||||
completeCharFields(FCompatibility)
|
|
||||||
computeNonStarterCounts()
|
|
||||||
verifyComputed()
|
|
||||||
printChars()
|
|
||||||
testDerived()
|
|
||||||
printTestdata()
|
|
||||||
makeTables()
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
tablelist = flag.String("tables",
|
|
||||||
"all",
|
|
||||||
"comma-separated list of which tables to generate; "+
|
|
||||||
"can be 'decomp', 'recomp', 'info' and 'all'")
|
|
||||||
test = flag.Bool("test",
|
|
||||||
false,
|
|
||||||
"test existing tables against DerivedNormalizationProps and generate test data for regression testing")
|
|
||||||
verbose = flag.Bool("verbose",
|
|
||||||
false,
|
|
||||||
"write data to stdout as it is parsed")
|
|
||||||
)
|
|
||||||
|
|
||||||
const MaxChar = 0x10FFFF // anything above this shouldn't exist
|
|
||||||
|
|
||||||
// Quick Check properties of runes allow us to quickly
|
|
||||||
// determine whether a rune may occur in a normal form.
|
|
||||||
// For a given normal form, a rune may be guaranteed to occur
|
|
||||||
// verbatim (QC=Yes), may or may not combine with another
|
|
||||||
// rune (QC=Maybe), or may not occur (QC=No).
|
|
||||||
type QCResult int
|
|
||||||
|
|
||||||
const (
|
|
||||||
QCUnknown QCResult = iota
|
|
||||||
QCYes
|
|
||||||
QCNo
|
|
||||||
QCMaybe
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r QCResult) String() string {
|
|
||||||
switch r {
|
|
||||||
case QCYes:
|
|
||||||
return "Yes"
|
|
||||||
case QCNo:
|
|
||||||
return "No"
|
|
||||||
case QCMaybe:
|
|
||||||
return "Maybe"
|
|
||||||
}
|
|
||||||
return "***UNKNOWN***"
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
FCanonical = iota // NFC or NFD
|
|
||||||
FCompatibility // NFKC or NFKD
|
|
||||||
FNumberOfFormTypes
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
MComposed = iota // NFC or NFKC
|
|
||||||
MDecomposed // NFD or NFKD
|
|
||||||
MNumberOfModes
|
|
||||||
)
|
|
||||||
|
|
||||||
// This contains only the properties we're interested in.
|
|
||||||
type Char struct {
|
|
||||||
name string
|
|
||||||
codePoint rune // if zero, this index is not a valid code point.
|
|
||||||
ccc uint8 // canonical combining class
|
|
||||||
origCCC uint8
|
|
||||||
excludeInComp bool // from CompositionExclusions.txt
|
|
||||||
compatDecomp bool // it has a compatibility expansion
|
|
||||||
|
|
||||||
nTrailingNonStarters uint8
|
|
||||||
nLeadingNonStarters uint8 // must be equal to trailing if non-zero
|
|
||||||
|
|
||||||
forms [FNumberOfFormTypes]FormInfo // For FCanonical and FCompatibility
|
|
||||||
|
|
||||||
state State
|
|
||||||
}
|
|
||||||
|
|
||||||
var chars = make([]Char, MaxChar+1)
|
|
||||||
var cccMap = make(map[uint8]uint8)
|
|
||||||
|
|
||||||
func (c Char) String() string {
|
|
||||||
buf := new(bytes.Buffer)
|
|
||||||
|
|
||||||
fmt.Fprintf(buf, "%U [%s]:\n", c.codePoint, c.name)
|
|
||||||
fmt.Fprintf(buf, " ccc: %v\n", c.ccc)
|
|
||||||
fmt.Fprintf(buf, " excludeInComp: %v\n", c.excludeInComp)
|
|
||||||
fmt.Fprintf(buf, " compatDecomp: %v\n", c.compatDecomp)
|
|
||||||
fmt.Fprintf(buf, " state: %v\n", c.state)
|
|
||||||
fmt.Fprintf(buf, " NFC:\n")
|
|
||||||
fmt.Fprint(buf, c.forms[FCanonical])
|
|
||||||
fmt.Fprintf(buf, " NFKC:\n")
|
|
||||||
fmt.Fprint(buf, c.forms[FCompatibility])
|
|
||||||
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
// In UnicodeData.txt, some ranges are marked like this:
|
|
||||||
// 3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
|
|
||||||
// 4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
|
|
||||||
// parseCharacter keeps a state variable indicating the weirdness.
|
|
||||||
type State int
|
|
||||||
|
|
||||||
const (
|
|
||||||
SNormal State = iota // known to be zero for the type
|
|
||||||
SFirst
|
|
||||||
SLast
|
|
||||||
SMissing
|
|
||||||
)
|
|
||||||
|
|
||||||
var lastChar = rune('\u0000')
|
|
||||||
|
|
||||||
func (c Char) isValid() bool {
|
|
||||||
return c.codePoint != 0 && c.state != SMissing
|
|
||||||
}
|
|
||||||
|
|
||||||
type FormInfo struct {
|
|
||||||
quickCheck [MNumberOfModes]QCResult // index: MComposed or MDecomposed
|
|
||||||
verified [MNumberOfModes]bool // index: MComposed or MDecomposed
|
|
||||||
|
|
||||||
combinesForward bool // May combine with rune on the right
|
|
||||||
combinesBackward bool // May combine with rune on the left
|
|
||||||
isOneWay bool // Never appears in result
|
|
||||||
inDecomp bool // Some decompositions result in this char.
|
|
||||||
decomp Decomposition
|
|
||||||
expandedDecomp Decomposition
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f FormInfo) String() string {
|
|
||||||
buf := bytes.NewBuffer(make([]byte, 0))
|
|
||||||
|
|
||||||
fmt.Fprintf(buf, " quickCheck[C]: %v\n", f.quickCheck[MComposed])
|
|
||||||
fmt.Fprintf(buf, " quickCheck[D]: %v\n", f.quickCheck[MDecomposed])
|
|
||||||
fmt.Fprintf(buf, " cmbForward: %v\n", f.combinesForward)
|
|
||||||
fmt.Fprintf(buf, " cmbBackward: %v\n", f.combinesBackward)
|
|
||||||
fmt.Fprintf(buf, " isOneWay: %v\n", f.isOneWay)
|
|
||||||
fmt.Fprintf(buf, " inDecomp: %v\n", f.inDecomp)
|
|
||||||
fmt.Fprintf(buf, " decomposition: %X\n", f.decomp)
|
|
||||||
fmt.Fprintf(buf, " expandedDecomp: %X\n", f.expandedDecomp)
|
|
||||||
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
type Decomposition []rune
|
|
||||||
|
|
||||||
func parseDecomposition(s string, skipfirst bool) (a []rune, err error) {
|
|
||||||
decomp := strings.Split(s, " ")
|
|
||||||
if len(decomp) > 0 && skipfirst {
|
|
||||||
decomp = decomp[1:]
|
|
||||||
}
|
|
||||||
for _, d := range decomp {
|
|
||||||
point, err := strconv.ParseUint(d, 16, 64)
|
|
||||||
if err != nil {
|
|
||||||
return a, err
|
|
||||||
}
|
|
||||||
a = append(a, rune(point))
|
|
||||||
}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadUnicodeData() {
|
|
||||||
f := gen.OpenUCDFile("UnicodeData.txt")
|
|
||||||
defer f.Close()
|
|
||||||
p := ucd.New(f)
|
|
||||||
for p.Next() {
|
|
||||||
r := p.Rune(ucd.CodePoint)
|
|
||||||
char := &chars[r]
|
|
||||||
|
|
||||||
char.ccc = uint8(p.Uint(ucd.CanonicalCombiningClass))
|
|
||||||
decmap := p.String(ucd.DecompMapping)
|
|
||||||
|
|
||||||
exp, err := parseDecomposition(decmap, false)
|
|
||||||
isCompat := false
|
|
||||||
if err != nil {
|
|
||||||
if len(decmap) > 0 {
|
|
||||||
exp, err = parseDecomposition(decmap, true)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf(`%U: bad decomp |%v|: "%s"`, r, decmap, err)
|
|
||||||
}
|
|
||||||
isCompat = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char.name = p.String(ucd.Name)
|
|
||||||
char.codePoint = r
|
|
||||||
char.forms[FCompatibility].decomp = exp
|
|
||||||
if !isCompat {
|
|
||||||
char.forms[FCanonical].decomp = exp
|
|
||||||
} else {
|
|
||||||
char.compatDecomp = true
|
|
||||||
}
|
|
||||||
if len(decmap) > 0 {
|
|
||||||
char.forms[FCompatibility].decomp = exp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := p.Err(); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// compactCCC converts the sparse set of CCC values to a continguous one,
|
|
||||||
// reducing the number of bits needed from 8 to 6.
|
|
||||||
func compactCCC() {
|
|
||||||
m := make(map[uint8]uint8)
|
|
||||||
for i := range chars {
|
|
||||||
c := &chars[i]
|
|
||||||
m[c.ccc] = 0
|
|
||||||
}
|
|
||||||
cccs := []int{}
|
|
||||||
for v, _ := range m {
|
|
||||||
cccs = append(cccs, int(v))
|
|
||||||
}
|
|
||||||
sort.Ints(cccs)
|
|
||||||
for i, c := range cccs {
|
|
||||||
cccMap[uint8(i)] = uint8(c)
|
|
||||||
m[uint8(c)] = uint8(i)
|
|
||||||
}
|
|
||||||
for i := range chars {
|
|
||||||
c := &chars[i]
|
|
||||||
c.origCCC = c.ccc
|
|
||||||
c.ccc = m[c.ccc]
|
|
||||||
}
|
|
||||||
if len(m) >= 1<<6 {
|
|
||||||
log.Fatalf("too many difference CCC values: %d >= 64", len(m))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CompositionExclusions.txt has form:
|
|
||||||
// 0958 # ...
|
|
||||||
// See http://unicode.org/reports/tr44/ for full explanation
|
|
||||||
func loadCompositionExclusions() {
|
|
||||||
f := gen.OpenUCDFile("CompositionExclusions.txt")
|
|
||||||
defer f.Close()
|
|
||||||
p := ucd.New(f)
|
|
||||||
for p.Next() {
|
|
||||||
c := &chars[p.Rune(0)]
|
|
||||||
if c.excludeInComp {
|
|
||||||
log.Fatalf("%U: Duplicate entry in exclusions.", c.codePoint)
|
|
||||||
}
|
|
||||||
c.excludeInComp = true
|
|
||||||
}
|
|
||||||
if e := p.Err(); e != nil {
|
|
||||||
log.Fatal(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// hasCompatDecomp returns true if any of the recursive
|
|
||||||
// decompositions contains a compatibility expansion.
|
|
||||||
// In this case, the character may not occur in NFK*.
|
|
||||||
func hasCompatDecomp(r rune) bool {
|
|
||||||
c := &chars[r]
|
|
||||||
if c.compatDecomp {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
for _, d := range c.forms[FCompatibility].decomp {
|
|
||||||
if hasCompatDecomp(d) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hangul related constants.
|
|
||||||
const (
|
|
||||||
HangulBase = 0xAC00
|
|
||||||
HangulEnd = 0xD7A4 // hangulBase + Jamo combinations (19 * 21 * 28)
|
|
||||||
|
|
||||||
JamoLBase = 0x1100
|
|
||||||
JamoLEnd = 0x1113
|
|
||||||
JamoVBase = 0x1161
|
|
||||||
JamoVEnd = 0x1176
|
|
||||||
JamoTBase = 0x11A8
|
|
||||||
JamoTEnd = 0x11C3
|
|
||||||
|
|
||||||
JamoLVTCount = 19 * 21 * 28
|
|
||||||
JamoTCount = 28
|
|
||||||
)
|
|
||||||
|
|
||||||
func isHangul(r rune) bool {
|
|
||||||
return HangulBase <= r && r < HangulEnd
|
|
||||||
}
|
|
||||||
|
|
||||||
func isHangulWithoutJamoT(r rune) bool {
|
|
||||||
if !isHangul(r) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
r -= HangulBase
|
|
||||||
return r < JamoLVTCount && r%JamoTCount == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func ccc(r rune) uint8 {
|
|
||||||
return chars[r].ccc
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert a rune in a buffer, ordered by Canonical Combining Class.
|
|
||||||
func insertOrdered(b Decomposition, r rune) Decomposition {
|
|
||||||
n := len(b)
|
|
||||||
b = append(b, 0)
|
|
||||||
cc := ccc(r)
|
|
||||||
if cc > 0 {
|
|
||||||
// Use bubble sort.
|
|
||||||
for ; n > 0; n-- {
|
|
||||||
if ccc(b[n-1]) <= cc {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
b[n] = b[n-1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
b[n] = r
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recursively decompose.
|
|
||||||
func decomposeRecursive(form int, r rune, d Decomposition) Decomposition {
|
|
||||||
dcomp := chars[r].forms[form].decomp
|
|
||||||
if len(dcomp) == 0 {
|
|
||||||
return insertOrdered(d, r)
|
|
||||||
}
|
|
||||||
for _, c := range dcomp {
|
|
||||||
d = decomposeRecursive(form, c, d)
|
|
||||||
}
|
|
||||||
return d
|
|
||||||
}
|
|
||||||
|
|
||||||
func completeCharFields(form int) {
|
|
||||||
// Phase 0: pre-expand decomposition.
|
|
||||||
for i := range chars {
|
|
||||||
f := &chars[i].forms[form]
|
|
||||||
if len(f.decomp) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
exp := make(Decomposition, 0)
|
|
||||||
for _, c := range f.decomp {
|
|
||||||
exp = decomposeRecursive(form, c, exp)
|
|
||||||
}
|
|
||||||
f.expandedDecomp = exp
|
|
||||||
}
|
|
||||||
|
|
||||||
// Phase 1: composition exclusion, mark decomposition.
|
|
||||||
for i := range chars {
|
|
||||||
c := &chars[i]
|
|
||||||
f := &c.forms[form]
|
|
||||||
|
|
||||||
// Marks script-specific exclusions and version restricted.
|
|
||||||
f.isOneWay = c.excludeInComp
|
|
||||||
|
|
||||||
// Singletons
|
|
||||||
f.isOneWay = f.isOneWay || len(f.decomp) == 1
|
|
||||||
|
|
||||||
// Non-starter decompositions
|
|
||||||
if len(f.decomp) > 1 {
|
|
||||||
chk := c.ccc != 0 || chars[f.decomp[0]].ccc != 0
|
|
||||||
f.isOneWay = f.isOneWay || chk
|
|
||||||
}
|
|
||||||
|
|
||||||
// Runes that decompose into more than two runes.
|
|
||||||
f.isOneWay = f.isOneWay || len(f.decomp) > 2
|
|
||||||
|
|
||||||
if form == FCompatibility {
|
|
||||||
f.isOneWay = f.isOneWay || hasCompatDecomp(c.codePoint)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, r := range f.decomp {
|
|
||||||
chars[r].forms[form].inDecomp = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Phase 2: forward and backward combining.
|
|
||||||
for i := range chars {
|
|
||||||
c := &chars[i]
|
|
||||||
f := &c.forms[form]
|
|
||||||
|
|
||||||
if !f.isOneWay && len(f.decomp) == 2 {
|
|
||||||
f0 := &chars[f.decomp[0]].forms[form]
|
|
||||||
f1 := &chars[f.decomp[1]].forms[form]
|
|
||||||
if !f0.isOneWay {
|
|
||||||
f0.combinesForward = true
|
|
||||||
}
|
|
||||||
if !f1.isOneWay {
|
|
||||||
f1.combinesBackward = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if isHangulWithoutJamoT(rune(i)) {
|
|
||||||
f.combinesForward = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Phase 3: quick check values.
|
|
||||||
for i := range chars {
|
|
||||||
c := &chars[i]
|
|
||||||
f := &c.forms[form]
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case len(f.decomp) > 0:
|
|
||||||
f.quickCheck[MDecomposed] = QCNo
|
|
||||||
case isHangul(rune(i)):
|
|
||||||
f.quickCheck[MDecomposed] = QCNo
|
|
||||||
default:
|
|
||||||
f.quickCheck[MDecomposed] = QCYes
|
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case f.isOneWay:
|
|
||||||
f.quickCheck[MComposed] = QCNo
|
|
||||||
case (i & 0xffff00) == JamoLBase:
|
|
||||||
f.quickCheck[MComposed] = QCYes
|
|
||||||
if JamoLBase <= i && i < JamoLEnd {
|
|
||||||
f.combinesForward = true
|
|
||||||
}
|
|
||||||
if JamoVBase <= i && i < JamoVEnd {
|
|
||||||
f.quickCheck[MComposed] = QCMaybe
|
|
||||||
f.combinesBackward = true
|
|
||||||
f.combinesForward = true
|
|
||||||
}
|
|
||||||
if JamoTBase <= i && i < JamoTEnd {
|
|
||||||
f.quickCheck[MComposed] = QCMaybe
|
|
||||||
f.combinesBackward = true
|
|
||||||
}
|
|
||||||
case !f.combinesBackward:
|
|
||||||
f.quickCheck[MComposed] = QCYes
|
|
||||||
default:
|
|
||||||
f.quickCheck[MComposed] = QCMaybe
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func computeNonStarterCounts() {
|
|
||||||
// Phase 4: leading and trailing non-starter count
|
|
||||||
for i := range chars {
|
|
||||||
c := &chars[i]
|
|
||||||
|
|
||||||
runes := []rune{rune(i)}
|
|
||||||
// We always use FCompatibility so that the CGJ insertion points do not
|
|
||||||
// change for repeated normalizations with different forms.
|
|
||||||
if exp := c.forms[FCompatibility].expandedDecomp; len(exp) > 0 {
|
|
||||||
runes = exp
|
|
||||||
}
|
|
||||||
// We consider runes that combine backwards to be non-starters for the
|
|
||||||
// purpose of Stream-Safe Text Processing.
|
|
||||||
for _, r := range runes {
|
|
||||||
if cr := &chars[r]; cr.ccc == 0 && !cr.forms[FCompatibility].combinesBackward {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
c.nLeadingNonStarters++
|
|
||||||
}
|
|
||||||
for i := len(runes) - 1; i >= 0; i-- {
|
|
||||||
if cr := &chars[runes[i]]; cr.ccc == 0 && !cr.forms[FCompatibility].combinesBackward {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
c.nTrailingNonStarters++
|
|
||||||
}
|
|
||||||
if c.nTrailingNonStarters > 3 {
|
|
||||||
log.Fatalf("%U: Decomposition with more than 3 (%d) trailing modifiers (%U)", i, c.nTrailingNonStarters, runes)
|
|
||||||
}
|
|
||||||
|
|
||||||
if isHangul(rune(i)) {
|
|
||||||
c.nTrailingNonStarters = 2
|
|
||||||
if isHangulWithoutJamoT(rune(i)) {
|
|
||||||
c.nTrailingNonStarters = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if l, t := c.nLeadingNonStarters, c.nTrailingNonStarters; l > 0 && l != t {
|
|
||||||
log.Fatalf("%U: number of leading and trailing non-starters should be equal (%d vs %d)", i, l, t)
|
|
||||||
}
|
|
||||||
if t := c.nTrailingNonStarters; t > 3 {
|
|
||||||
log.Fatalf("%U: number of trailing non-starters is %d > 3", t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func printBytes(w io.Writer, b []byte, name string) {
|
|
||||||
fmt.Fprintf(w, "// %s: %d bytes\n", name, len(b))
|
|
||||||
fmt.Fprintf(w, "var %s = [...]byte {", name)
|
|
||||||
for i, c := range b {
|
|
||||||
switch {
|
|
||||||
case i%64 == 0:
|
|
||||||
fmt.Fprintf(w, "\n// Bytes %x - %x\n", i, i+63)
|
|
||||||
case i%8 == 0:
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
}
|
|
||||||
fmt.Fprintf(w, "0x%.2X, ", c)
|
|
||||||
}
|
|
||||||
fmt.Fprint(w, "\n}\n\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
// See forminfo.go for format.
|
|
||||||
func makeEntry(f *FormInfo, c *Char) uint16 {
|
|
||||||
e := uint16(0)
|
|
||||||
if r := c.codePoint; HangulBase <= r && r < HangulEnd {
|
|
||||||
e |= 0x40
|
|
||||||
}
|
|
||||||
if f.combinesForward {
|
|
||||||
e |= 0x20
|
|
||||||
}
|
|
||||||
if f.quickCheck[MDecomposed] == QCNo {
|
|
||||||
e |= 0x4
|
|
||||||
}
|
|
||||||
switch f.quickCheck[MComposed] {
|
|
||||||
case QCYes:
|
|
||||||
case QCNo:
|
|
||||||
e |= 0x10
|
|
||||||
case QCMaybe:
|
|
||||||
e |= 0x18
|
|
||||||
default:
|
|
||||||
log.Fatalf("Illegal quickcheck value %v.", f.quickCheck[MComposed])
|
|
||||||
}
|
|
||||||
e |= uint16(c.nTrailingNonStarters)
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
// decompSet keeps track of unique decompositions, grouped by whether
|
|
||||||
// the decomposition is followed by a trailing and/or leading CCC.
|
|
||||||
type decompSet [7]map[string]bool
|
|
||||||
|
|
||||||
const (
|
|
||||||
normalDecomp = iota
|
|
||||||
firstMulti
|
|
||||||
firstCCC
|
|
||||||
endMulti
|
|
||||||
firstLeadingCCC
|
|
||||||
firstCCCZeroExcept
|
|
||||||
firstStarterWithNLead
|
|
||||||
lastDecomp
|
|
||||||
)
|
|
||||||
|
|
||||||
var cname = []string{"firstMulti", "firstCCC", "endMulti", "firstLeadingCCC", "firstCCCZeroExcept", "firstStarterWithNLead", "lastDecomp"}
|
|
||||||
|
|
||||||
func makeDecompSet() decompSet {
|
|
||||||
m := decompSet{}
|
|
||||||
for i := range m {
|
|
||||||
m[i] = make(map[string]bool)
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
func (m *decompSet) insert(key int, s string) {
|
|
||||||
m[key][s] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
func printCharInfoTables(w io.Writer) int {
|
|
||||||
mkstr := func(r rune, f *FormInfo) (int, string) {
|
|
||||||
d := f.expandedDecomp
|
|
||||||
s := string([]rune(d))
|
|
||||||
if max := 1 << 6; len(s) >= max {
|
|
||||||
const msg = "%U: too many bytes in decomposition: %d >= %d"
|
|
||||||
log.Fatalf(msg, r, len(s), max)
|
|
||||||
}
|
|
||||||
head := uint8(len(s))
|
|
||||||
if f.quickCheck[MComposed] != QCYes {
|
|
||||||
head |= 0x40
|
|
||||||
}
|
|
||||||
if f.combinesForward {
|
|
||||||
head |= 0x80
|
|
||||||
}
|
|
||||||
s = string([]byte{head}) + s
|
|
||||||
|
|
||||||
lccc := ccc(d[0])
|
|
||||||
tccc := ccc(d[len(d)-1])
|
|
||||||
cc := ccc(r)
|
|
||||||
if cc != 0 && lccc == 0 && tccc == 0 {
|
|
||||||
log.Fatalf("%U: trailing and leading ccc are 0 for non-zero ccc %d", r, cc)
|
|
||||||
}
|
|
||||||
if tccc < lccc && lccc != 0 {
|
|
||||||
const msg = "%U: lccc (%d) must be <= tcc (%d)"
|
|
||||||
log.Fatalf(msg, r, lccc, tccc)
|
|
||||||
}
|
|
||||||
index := normalDecomp
|
|
||||||
nTrail := chars[r].nTrailingNonStarters
|
|
||||||
nLead := chars[r].nLeadingNonStarters
|
|
||||||
if tccc > 0 || lccc > 0 || nTrail > 0 {
|
|
||||||
tccc <<= 2
|
|
||||||
tccc |= nTrail
|
|
||||||
s += string([]byte{tccc})
|
|
||||||
index = endMulti
|
|
||||||
for _, r := range d[1:] {
|
|
||||||
if ccc(r) == 0 {
|
|
||||||
index = firstCCC
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if lccc > 0 || nLead > 0 {
|
|
||||||
s += string([]byte{lccc})
|
|
||||||
if index == firstCCC {
|
|
||||||
log.Fatalf("%U: multi-segment decomposition not supported for decompositions with leading CCC != 0", r)
|
|
||||||
}
|
|
||||||
index = firstLeadingCCC
|
|
||||||
}
|
|
||||||
if cc != lccc {
|
|
||||||
if cc != 0 {
|
|
||||||
log.Fatalf("%U: for lccc != ccc, expected ccc to be 0; was %d", r, cc)
|
|
||||||
}
|
|
||||||
index = firstCCCZeroExcept
|
|
||||||
}
|
|
||||||
} else if len(d) > 1 {
|
|
||||||
index = firstMulti
|
|
||||||
}
|
|
||||||
return index, s
|
|
||||||
}
|
|
||||||
|
|
||||||
decompSet := makeDecompSet()
|
|
||||||
const nLeadStr = "\x00\x01" // 0-byte length and tccc with nTrail.
|
|
||||||
decompSet.insert(firstStarterWithNLead, nLeadStr)
|
|
||||||
|
|
||||||
// Store the uniqued decompositions in a byte buffer,
|
|
||||||
// preceded by their byte length.
|
|
||||||
for _, c := range chars {
|
|
||||||
for _, f := range c.forms {
|
|
||||||
if len(f.expandedDecomp) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if f.combinesBackward {
|
|
||||||
log.Fatalf("%U: combinesBackward and decompose", c.codePoint)
|
|
||||||
}
|
|
||||||
index, s := mkstr(c.codePoint, &f)
|
|
||||||
decompSet.insert(index, s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
decompositions := bytes.NewBuffer(make([]byte, 0, 10000))
|
|
||||||
size := 0
|
|
||||||
positionMap := make(map[string]uint16)
|
|
||||||
decompositions.WriteString("\000")
|
|
||||||
fmt.Fprintln(w, "const (")
|
|
||||||
for i, m := range decompSet {
|
|
||||||
sa := []string{}
|
|
||||||
for s := range m {
|
|
||||||
sa = append(sa, s)
|
|
||||||
}
|
|
||||||
sort.Strings(sa)
|
|
||||||
for _, s := range sa {
|
|
||||||
p := decompositions.Len()
|
|
||||||
decompositions.WriteString(s)
|
|
||||||
positionMap[s] = uint16(p)
|
|
||||||
}
|
|
||||||
if cname[i] != "" {
|
|
||||||
fmt.Fprintf(w, "%s = 0x%X\n", cname[i], decompositions.Len())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Fprintln(w, "maxDecomp = 0x8000")
|
|
||||||
fmt.Fprintln(w, ")")
|
|
||||||
b := decompositions.Bytes()
|
|
||||||
printBytes(w, b, "decomps")
|
|
||||||
size += len(b)
|
|
||||||
|
|
||||||
varnames := []string{"nfc", "nfkc"}
|
|
||||||
for i := 0; i < FNumberOfFormTypes; i++ {
|
|
||||||
trie := triegen.NewTrie(varnames[i])
|
|
||||||
|
|
||||||
for r, c := range chars {
|
|
||||||
f := c.forms[i]
|
|
||||||
d := f.expandedDecomp
|
|
||||||
if len(d) != 0 {
|
|
||||||
_, key := mkstr(c.codePoint, &f)
|
|
||||||
trie.Insert(rune(r), uint64(positionMap[key]))
|
|
||||||
if c.ccc != ccc(d[0]) {
|
|
||||||
// We assume the lead ccc of a decomposition !=0 in this case.
|
|
||||||
if ccc(d[0]) == 0 {
|
|
||||||
log.Fatalf("Expected leading CCC to be non-zero; ccc is %d", c.ccc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if c.nLeadingNonStarters > 0 && len(f.expandedDecomp) == 0 && c.ccc == 0 && !f.combinesBackward {
|
|
||||||
// Handle cases where it can't be detected that the nLead should be equal
|
|
||||||
// to nTrail.
|
|
||||||
trie.Insert(c.codePoint, uint64(positionMap[nLeadStr]))
|
|
||||||
} else if v := makeEntry(&f, &c)<<8 | uint16(c.ccc); v != 0 {
|
|
||||||
trie.Insert(c.codePoint, uint64(0x8000|v))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sz, err := trie.Gen(w, triegen.Compact(&normCompacter{name: varnames[i]}))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
size += sz
|
|
||||||
}
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
func contains(sa []string, s string) bool {
|
|
||||||
for _, a := range sa {
|
|
||||||
if a == s {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeTables() {
|
|
||||||
w := &bytes.Buffer{}
|
|
||||||
|
|
||||||
size := 0
|
|
||||||
if *tablelist == "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
list := strings.Split(*tablelist, ",")
|
|
||||||
if *tablelist == "all" {
|
|
||||||
list = []string{"recomp", "info"}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute maximum decomposition size.
|
|
||||||
max := 0
|
|
||||||
for _, c := range chars {
|
|
||||||
if n := len(string(c.forms[FCompatibility].expandedDecomp)); n > max {
|
|
||||||
max = n
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintln(w, "const (")
|
|
||||||
fmt.Fprintln(w, "\t// Version is the Unicode edition from which the tables are derived.")
|
|
||||||
fmt.Fprintf(w, "\tVersion = %q\n", gen.UnicodeVersion())
|
|
||||||
fmt.Fprintln(w)
|
|
||||||
fmt.Fprintln(w, "\t// MaxTransformChunkSize indicates the maximum number of bytes that Transform")
|
|
||||||
fmt.Fprintln(w, "\t// may need to write atomically for any Form. Making a destination buffer at")
|
|
||||||
fmt.Fprintln(w, "\t// least this size ensures that Transform can always make progress and that")
|
|
||||||
fmt.Fprintln(w, "\t// the user does not need to grow the buffer on an ErrShortDst.")
|
|
||||||
fmt.Fprintf(w, "\tMaxTransformChunkSize = %d+maxNonStarters*4\n", len(string(0x034F))+max)
|
|
||||||
fmt.Fprintln(w, ")\n")
|
|
||||||
|
|
||||||
// Print the CCC remap table.
|
|
||||||
size += len(cccMap)
|
|
||||||
fmt.Fprintf(w, "var ccc = [%d]uint8{", len(cccMap))
|
|
||||||
for i := 0; i < len(cccMap); i++ {
|
|
||||||
if i%8 == 0 {
|
|
||||||
fmt.Fprintln(w)
|
|
||||||
}
|
|
||||||
fmt.Fprintf(w, "%3d, ", cccMap[uint8(i)])
|
|
||||||
}
|
|
||||||
fmt.Fprintln(w, "\n}\n")
|
|
||||||
|
|
||||||
if contains(list, "info") {
|
|
||||||
size += printCharInfoTables(w)
|
|
||||||
}
|
|
||||||
|
|
||||||
if contains(list, "recomp") {
|
|
||||||
// Note that we use 32 bit keys, instead of 64 bit.
|
|
||||||
// This clips the bits of three entries, but we know
|
|
||||||
// this won't cause a collision. The compiler will catch
|
|
||||||
// any changes made to UnicodeData.txt that introduces
|
|
||||||
// a collision.
|
|
||||||
// Note that the recomposition map for NFC and NFKC
|
|
||||||
// are identical.
|
|
||||||
|
|
||||||
// Recomposition map
|
|
||||||
nrentries := 0
|
|
||||||
for _, c := range chars {
|
|
||||||
f := c.forms[FCanonical]
|
|
||||||
if !f.isOneWay && len(f.decomp) > 0 {
|
|
||||||
nrentries++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sz := nrentries * 8
|
|
||||||
size += sz
|
|
||||||
fmt.Fprintf(w, "// recompMap: %d bytes (entries only)\n", sz)
|
|
||||||
fmt.Fprintln(w, "var recompMap = map[uint32]rune{")
|
|
||||||
for i, c := range chars {
|
|
||||||
f := c.forms[FCanonical]
|
|
||||||
d := f.decomp
|
|
||||||
if !f.isOneWay && len(d) > 0 {
|
|
||||||
key := uint32(uint16(d[0]))<<16 + uint32(uint16(d[1]))
|
|
||||||
fmt.Fprintf(w, "0x%.8X: 0x%.4X,\n", key, i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Fprintf(w, "}\n\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "// Total size of tables: %dKB (%d bytes)\n", (size+512)/1024, size)
|
|
||||||
gen.WriteVersionedGoFile("tables.go", "norm", w.Bytes())
|
|
||||||
}
|
|
||||||
|
|
||||||
func printChars() {
|
|
||||||
if *verbose {
|
|
||||||
for _, c := range chars {
|
|
||||||
if !c.isValid() || c.state == SMissing {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fmt.Println(c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// verifyComputed does various consistency tests.
|
|
||||||
func verifyComputed() {
|
|
||||||
for i, c := range chars {
|
|
||||||
for _, f := range c.forms {
|
|
||||||
isNo := (f.quickCheck[MDecomposed] == QCNo)
|
|
||||||
if (len(f.decomp) > 0) != isNo && !isHangul(rune(i)) {
|
|
||||||
log.Fatalf("%U: NF*D QC must be No if rune decomposes", i)
|
|
||||||
}
|
|
||||||
|
|
||||||
isMaybe := f.quickCheck[MComposed] == QCMaybe
|
|
||||||
if f.combinesBackward != isMaybe {
|
|
||||||
log.Fatalf("%U: NF*C QC must be Maybe if combinesBackward", i)
|
|
||||||
}
|
|
||||||
if len(f.decomp) > 0 && f.combinesForward && isMaybe {
|
|
||||||
log.Fatalf("%U: NF*C QC must be Yes or No if combinesForward and decomposes", i)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(f.expandedDecomp) != 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if a, b := c.nLeadingNonStarters > 0, (c.ccc > 0 || f.combinesBackward); a != b {
|
|
||||||
// We accept these runes to be treated differently (it only affects
|
|
||||||
// segment breaking in iteration, most likely on improper use), but
|
|
||||||
// reconsider if more characters are added.
|
|
||||||
// U+FF9E HALFWIDTH KATAKANA VOICED SOUND MARK;Lm;0;L;<narrow> 3099;;;;N;;;;;
|
|
||||||
// U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK;Lm;0;L;<narrow> 309A;;;;N;;;;;
|
|
||||||
// U+3133 HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<compat> 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;;
|
|
||||||
// U+318E HANGUL LETTER ARAEAE;Lo;0;L;<compat> 11A1;;;;N;HANGUL LETTER ALAE AE;;;;
|
|
||||||
// U+FFA3 HALFWIDTH HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<narrow> 3133;;;;N;HALFWIDTH HANGUL LETTER GIYEOG SIOS;;;;
|
|
||||||
// U+FFDC HALFWIDTH HANGUL LETTER I;Lo;0;L;<narrow> 3163;;;;N;;;;;
|
|
||||||
if i != 0xFF9E && i != 0xFF9F && !(0x3133 <= i && i <= 0x318E) && !(0xFFA3 <= i && i <= 0xFFDC) {
|
|
||||||
log.Fatalf("%U: nLead was %v; want %v", i, a, b)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nfc := c.forms[FCanonical]
|
|
||||||
nfkc := c.forms[FCompatibility]
|
|
||||||
if nfc.combinesBackward != nfkc.combinesBackward {
|
|
||||||
log.Fatalf("%U: Cannot combine combinesBackward\n", c.codePoint)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use values in DerivedNormalizationProps.txt to compare against the
|
|
||||||
// values we computed.
|
|
||||||
// DerivedNormalizationProps.txt has form:
|
|
||||||
// 00C0..00C5 ; NFD_QC; N # ...
|
|
||||||
// 0374 ; NFD_QC; N # ...
|
|
||||||
// See http://unicode.org/reports/tr44/ for full explanation
|
|
||||||
func testDerived() {
|
|
||||||
f := gen.OpenUCDFile("DerivedNormalizationProps.txt")
|
|
||||||
defer f.Close()
|
|
||||||
p := ucd.New(f)
|
|
||||||
for p.Next() {
|
|
||||||
r := p.Rune(0)
|
|
||||||
c := &chars[r]
|
|
||||||
|
|
||||||
var ftype, mode int
|
|
||||||
qt := p.String(1)
|
|
||||||
switch qt {
|
|
||||||
case "NFC_QC":
|
|
||||||
ftype, mode = FCanonical, MComposed
|
|
||||||
case "NFD_QC":
|
|
||||||
ftype, mode = FCanonical, MDecomposed
|
|
||||||
case "NFKC_QC":
|
|
||||||
ftype, mode = FCompatibility, MComposed
|
|
||||||
case "NFKD_QC":
|
|
||||||
ftype, mode = FCompatibility, MDecomposed
|
|
||||||
default:
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
var qr QCResult
|
|
||||||
switch p.String(2) {
|
|
||||||
case "Y":
|
|
||||||
qr = QCYes
|
|
||||||
case "N":
|
|
||||||
qr = QCNo
|
|
||||||
case "M":
|
|
||||||
qr = QCMaybe
|
|
||||||
default:
|
|
||||||
log.Fatalf(`Unexpected quick check value "%s"`, p.String(2))
|
|
||||||
}
|
|
||||||
if got := c.forms[ftype].quickCheck[mode]; got != qr {
|
|
||||||
log.Printf("%U: FAILED %s (was %v need %v)\n", r, qt, got, qr)
|
|
||||||
}
|
|
||||||
c.forms[ftype].verified[mode] = true
|
|
||||||
}
|
|
||||||
if err := p.Err(); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
// Any unspecified value must be QCYes. Verify this.
|
|
||||||
for i, c := range chars {
|
|
||||||
for j, fd := range c.forms {
|
|
||||||
for k, qr := range fd.quickCheck {
|
|
||||||
if !fd.verified[k] && qr != QCYes {
|
|
||||||
m := "%U: FAIL F:%d M:%d (was %v need Yes) %s\n"
|
|
||||||
log.Printf(m, i, j, k, qr, c.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var testHeader = `const (
|
|
||||||
Yes = iota
|
|
||||||
No
|
|
||||||
Maybe
|
|
||||||
)
|
|
||||||
|
|
||||||
type formData struct {
|
|
||||||
qc uint8
|
|
||||||
combinesForward bool
|
|
||||||
decomposition string
|
|
||||||
}
|
|
||||||
|
|
||||||
type runeData struct {
|
|
||||||
r rune
|
|
||||||
ccc uint8
|
|
||||||
nLead uint8
|
|
||||||
nTrail uint8
|
|
||||||
f [2]formData // 0: canonical; 1: compatibility
|
|
||||||
}
|
|
||||||
|
|
||||||
func f(qc uint8, cf bool, dec string) [2]formData {
|
|
||||||
return [2]formData{{qc, cf, dec}, {qc, cf, dec}}
|
|
||||||
}
|
|
||||||
|
|
||||||
func g(qc, qck uint8, cf, cfk bool, d, dk string) [2]formData {
|
|
||||||
return [2]formData{{qc, cf, d}, {qck, cfk, dk}}
|
|
||||||
}
|
|
||||||
|
|
||||||
var testData = []runeData{
|
|
||||||
`
|
|
||||||
|
|
||||||
func printTestdata() {
|
|
||||||
type lastInfo struct {
|
|
||||||
ccc uint8
|
|
||||||
nLead uint8
|
|
||||||
nTrail uint8
|
|
||||||
f string
|
|
||||||
}
|
|
||||||
|
|
||||||
last := lastInfo{}
|
|
||||||
w := &bytes.Buffer{}
|
|
||||||
fmt.Fprintf(w, testHeader)
|
|
||||||
for r, c := range chars {
|
|
||||||
f := c.forms[FCanonical]
|
|
||||||
qc, cf, d := f.quickCheck[MComposed], f.combinesForward, string(f.expandedDecomp)
|
|
||||||
f = c.forms[FCompatibility]
|
|
||||||
qck, cfk, dk := f.quickCheck[MComposed], f.combinesForward, string(f.expandedDecomp)
|
|
||||||
s := ""
|
|
||||||
if d == dk && qc == qck && cf == cfk {
|
|
||||||
s = fmt.Sprintf("f(%s, %v, %q)", qc, cf, d)
|
|
||||||
} else {
|
|
||||||
s = fmt.Sprintf("g(%s, %s, %v, %v, %q, %q)", qc, qck, cf, cfk, d, dk)
|
|
||||||
}
|
|
||||||
current := lastInfo{c.ccc, c.nLeadingNonStarters, c.nTrailingNonStarters, s}
|
|
||||||
if last != current {
|
|
||||||
fmt.Fprintf(w, "\t{0x%x, %d, %d, %d, %s},\n", r, c.origCCC, c.nLeadingNonStarters, c.nTrailingNonStarters, s)
|
|
||||||
last = current
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Fprintln(w, "}")
|
|
||||||
gen.WriteVersionedGoFile("data_test.go", "norm", w.Bytes())
|
|
||||||
}
|
|
117
vendor/golang.org/x/text/unicode/norm/triegen.go
generated
vendored
117
vendor/golang.org/x/text/unicode/norm/triegen.go
generated
vendored
|
@ -1,117 +0,0 @@
|
||||||
// Copyright 2011 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
// Trie table generator.
|
|
||||||
// Used by make*tables tools to generate a go file with trie data structures
|
|
||||||
// for mapping UTF-8 to a 16-bit value. All but the last byte in a UTF-8 byte
|
|
||||||
// sequence are used to lookup offsets in the index table to be used for the
|
|
||||||
// next byte. The last byte is used to index into a table with 16-bit values.
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
)
|
|
||||||
|
|
||||||
const maxSparseEntries = 16
|
|
||||||
|
|
||||||
type normCompacter struct {
|
|
||||||
sparseBlocks [][]uint64
|
|
||||||
sparseOffset []uint16
|
|
||||||
sparseCount int
|
|
||||||
name string
|
|
||||||
}
|
|
||||||
|
|
||||||
func mostFrequentStride(a []uint64) int {
|
|
||||||
counts := make(map[int]int)
|
|
||||||
var v int
|
|
||||||
for _, x := range a {
|
|
||||||
if stride := int(x) - v; v != 0 && stride >= 0 {
|
|
||||||
counts[stride]++
|
|
||||||
}
|
|
||||||
v = int(x)
|
|
||||||
}
|
|
||||||
var maxs, maxc int
|
|
||||||
for stride, cnt := range counts {
|
|
||||||
if cnt > maxc || (cnt == maxc && stride < maxs) {
|
|
||||||
maxs, maxc = stride, cnt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return maxs
|
|
||||||
}
|
|
||||||
|
|
||||||
func countSparseEntries(a []uint64) int {
|
|
||||||
stride := mostFrequentStride(a)
|
|
||||||
var v, count int
|
|
||||||
for _, tv := range a {
|
|
||||||
if int(tv)-v != stride {
|
|
||||||
if tv != 0 {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
v = int(tv)
|
|
||||||
}
|
|
||||||
return count
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *normCompacter) Size(v []uint64) (sz int, ok bool) {
|
|
||||||
if n := countSparseEntries(v); n <= maxSparseEntries {
|
|
||||||
return (n+1)*4 + 2, true
|
|
||||||
}
|
|
||||||
return 0, false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *normCompacter) Store(v []uint64) uint32 {
|
|
||||||
h := uint32(len(c.sparseOffset))
|
|
||||||
c.sparseBlocks = append(c.sparseBlocks, v)
|
|
||||||
c.sparseOffset = append(c.sparseOffset, uint16(c.sparseCount))
|
|
||||||
c.sparseCount += countSparseEntries(v) + 1
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *normCompacter) Handler() string {
|
|
||||||
return c.name + "Sparse.lookup"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *normCompacter) Print(w io.Writer) (retErr error) {
|
|
||||||
p := func(f string, x ...interface{}) {
|
|
||||||
if _, err := fmt.Fprintf(w, f, x...); retErr == nil && err != nil {
|
|
||||||
retErr = err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ls := len(c.sparseBlocks)
|
|
||||||
p("// %sSparseOffset: %d entries, %d bytes\n", c.name, ls, ls*2)
|
|
||||||
p("var %sSparseOffset = %#v\n\n", c.name, c.sparseOffset)
|
|
||||||
|
|
||||||
ns := c.sparseCount
|
|
||||||
p("// %sSparseValues: %d entries, %d bytes\n", c.name, ns, ns*4)
|
|
||||||
p("var %sSparseValues = [%d]valueRange {", c.name, ns)
|
|
||||||
for i, b := range c.sparseBlocks {
|
|
||||||
p("\n// Block %#x, offset %#x", i, c.sparseOffset[i])
|
|
||||||
var v int
|
|
||||||
stride := mostFrequentStride(b)
|
|
||||||
n := countSparseEntries(b)
|
|
||||||
p("\n{value:%#04x,lo:%#02x},", stride, uint8(n))
|
|
||||||
for i, nv := range b {
|
|
||||||
if int(nv)-v != stride {
|
|
||||||
if v != 0 {
|
|
||||||
p(",hi:%#02x},", 0x80+i-1)
|
|
||||||
}
|
|
||||||
if nv != 0 {
|
|
||||||
p("\n{value:%#04x,lo:%#02x", nv, 0x80+i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
v = int(nv)
|
|
||||||
}
|
|
||||||
if v != 0 {
|
|
||||||
p(",hi:%#02x},", 0x80+len(b)-1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p("\n}\n\n")
|
|
||||||
return
|
|
||||||
}
|
|
34
vendor/modules.txt
vendored
34
vendor/modules.txt
vendored
|
@ -1,21 +1,19 @@
|
||||||
# github.com/beorn7/perks v1.0.1
|
# github.com/beorn7/perks v1.0.1
|
||||||
github.com/beorn7/perks/quantile
|
github.com/beorn7/perks/quantile
|
||||||
# github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67
|
|
||||||
github.com/certifi/gocertifi
|
|
||||||
# github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
|
# github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
|
||||||
github.com/cpuguy83/go-md2man/v2/md2man
|
github.com/cpuguy83/go-md2man/v2/md2man
|
||||||
# github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067
|
# github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067
|
||||||
github.com/crosbymichael/guard/api/v1
|
github.com/crosbymichael/guard/api/v1
|
||||||
# github.com/getsentry/raven-go v0.2.0
|
# github.com/getsentry/sentry-go v0.6.1
|
||||||
github.com/getsentry/raven-go
|
github.com/getsentry/sentry-go
|
||||||
# github.com/gogo/googleapis v1.3.0
|
# github.com/gogo/googleapis v1.3.0
|
||||||
github.com/gogo/googleapis/google/api
|
github.com/gogo/googleapis/google/api
|
||||||
# github.com/gogo/protobuf v1.3.0
|
# github.com/gogo/protobuf v1.3.0
|
||||||
github.com/gogo/protobuf/gogoproto
|
github.com/gogo/protobuf/gogoproto
|
||||||
github.com/gogo/protobuf/proto
|
github.com/gogo/protobuf/proto
|
||||||
github.com/gogo/protobuf/types
|
|
||||||
github.com/gogo/protobuf/protoc-gen-gogo/descriptor
|
github.com/gogo/protobuf/protoc-gen-gogo/descriptor
|
||||||
github.com/gogo/protobuf/sortkeys
|
github.com/gogo/protobuf/sortkeys
|
||||||
|
github.com/gogo/protobuf/types
|
||||||
# github.com/golang/protobuf v1.3.2
|
# github.com/golang/protobuf v1.3.2
|
||||||
github.com/golang/protobuf/proto
|
github.com/golang/protobuf/proto
|
||||||
github.com/golang/protobuf/ptypes
|
github.com/golang/protobuf/ptypes
|
||||||
|
@ -37,8 +35,8 @@ github.com/prometheus/client_golang/prometheus/internal
|
||||||
github.com/prometheus/client_model/go
|
github.com/prometheus/client_model/go
|
||||||
# github.com/prometheus/common v0.6.0
|
# github.com/prometheus/common v0.6.0
|
||||||
github.com/prometheus/common/expfmt
|
github.com/prometheus/common/expfmt
|
||||||
github.com/prometheus/common/model
|
|
||||||
github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
|
github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
|
||||||
|
github.com/prometheus/common/model
|
||||||
# github.com/prometheus/procfs v0.0.3
|
# github.com/prometheus/procfs v0.0.3
|
||||||
github.com/prometheus/procfs
|
github.com/prometheus/procfs
|
||||||
github.com/prometheus/procfs/internal/fs
|
github.com/prometheus/procfs/internal/fs
|
||||||
|
@ -50,32 +48,34 @@ github.com/shurcooL/sanitized_anchor_name
|
||||||
github.com/sirupsen/logrus
|
github.com/sirupsen/logrus
|
||||||
# github.com/urfave/cli v1.22.1
|
# github.com/urfave/cli v1.22.1
|
||||||
github.com/urfave/cli
|
github.com/urfave/cli
|
||||||
# golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
|
# golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
|
||||||
golang.org/x/net/context
|
golang.org/x/net/context
|
||||||
golang.org/x/net/trace
|
golang.org/x/net/http/httpguts
|
||||||
golang.org/x/net/internal/timeseries
|
|
||||||
golang.org/x/net/http2
|
golang.org/x/net/http2
|
||||||
golang.org/x/net/http2/hpack
|
golang.org/x/net/http2/hpack
|
||||||
golang.org/x/net/http/httpguts
|
|
||||||
golang.org/x/net/idna
|
golang.org/x/net/idna
|
||||||
# golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3
|
golang.org/x/net/internal/timeseries
|
||||||
|
golang.org/x/net/trace
|
||||||
|
# golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
golang.org/x/sys/windows
|
golang.org/x/sys/windows
|
||||||
# golang.org/x/text v0.3.0
|
# golang.org/x/text v0.3.0
|
||||||
golang.org/x/text/secure/bidirule
|
golang.org/x/text/secure/bidirule
|
||||||
|
golang.org/x/text/transform
|
||||||
golang.org/x/text/unicode/bidi
|
golang.org/x/text/unicode/bidi
|
||||||
golang.org/x/text/unicode/norm
|
golang.org/x/text/unicode/norm
|
||||||
golang.org/x/text/transform
|
|
||||||
# google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
|
# google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
|
||||||
google.golang.org/genproto/googleapis/rpc/status
|
google.golang.org/genproto/googleapis/rpc/status
|
||||||
# google.golang.org/grpc v1.24.0
|
# google.golang.org/grpc v1.24.0
|
||||||
google.golang.org/grpc
|
google.golang.org/grpc
|
||||||
google.golang.org/grpc/codes
|
|
||||||
google.golang.org/grpc/status
|
|
||||||
google.golang.org/grpc/balancer
|
google.golang.org/grpc/balancer
|
||||||
|
google.golang.org/grpc/balancer/base
|
||||||
google.golang.org/grpc/balancer/roundrobin
|
google.golang.org/grpc/balancer/roundrobin
|
||||||
|
google.golang.org/grpc/binarylog/grpc_binarylog_v1
|
||||||
|
google.golang.org/grpc/codes
|
||||||
google.golang.org/grpc/connectivity
|
google.golang.org/grpc/connectivity
|
||||||
google.golang.org/grpc/credentials
|
google.golang.org/grpc/credentials
|
||||||
|
google.golang.org/grpc/credentials/internal
|
||||||
google.golang.org/grpc/encoding
|
google.golang.org/grpc/encoding
|
||||||
google.golang.org/grpc/encoding/proto
|
google.golang.org/grpc/encoding/proto
|
||||||
google.golang.org/grpc/grpclog
|
google.golang.org/grpc/grpclog
|
||||||
|
@ -87,6 +87,7 @@ google.golang.org/grpc/internal/channelz
|
||||||
google.golang.org/grpc/internal/envconfig
|
google.golang.org/grpc/internal/envconfig
|
||||||
google.golang.org/grpc/internal/grpcrand
|
google.golang.org/grpc/internal/grpcrand
|
||||||
google.golang.org/grpc/internal/grpcsync
|
google.golang.org/grpc/internal/grpcsync
|
||||||
|
google.golang.org/grpc/internal/syscall
|
||||||
google.golang.org/grpc/internal/transport
|
google.golang.org/grpc/internal/transport
|
||||||
google.golang.org/grpc/keepalive
|
google.golang.org/grpc/keepalive
|
||||||
google.golang.org/grpc/metadata
|
google.golang.org/grpc/metadata
|
||||||
|
@ -97,8 +98,5 @@ google.golang.org/grpc/resolver/dns
|
||||||
google.golang.org/grpc/resolver/passthrough
|
google.golang.org/grpc/resolver/passthrough
|
||||||
google.golang.org/grpc/serviceconfig
|
google.golang.org/grpc/serviceconfig
|
||||||
google.golang.org/grpc/stats
|
google.golang.org/grpc/stats
|
||||||
|
google.golang.org/grpc/status
|
||||||
google.golang.org/grpc/tap
|
google.golang.org/grpc/tap
|
||||||
google.golang.org/grpc/balancer/base
|
|
||||||
google.golang.org/grpc/credentials/internal
|
|
||||||
google.golang.org/grpc/binarylog/grpc_binarylog_v1
|
|
||||||
google.golang.org/grpc/internal/syscall
|
|
||||||
|
|
Loading…
Reference in a new issue