diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f1a2d14 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +vendor +cmd \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..802ecd8 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +[![Go Reference](https://pkg.go.dev/badge/github.com/mochi-co/mqtt.svg)](https://pkg.go.dev/github.com/dgduncan/mochi-cloud-hooks) + +# Mochi Hooks + +Hooks is a collection of hooks that can be imported and used for Mochi MQTT Broker. +Implementations of certain hooks are inspired by other open source projects + +### Table of contents + + + +- [Hooks](#hooks) + - [Auth](#auth) + - [HTTP](#http-auth) + + + + +### Hooks + +#### Auth + +##### HTTP + +The HTTP hook is a simple HTTP hook that uses two hooks to authorize the client to connect to the broker and authorizes topic level ACLs. +It works by checking the response code of each endpoint. If an endpoint returns back a non `2XX` response a `false` is returned from the hook. + +If additional functionality is required, a `callback` can be passed for custom response logic. Configuring a custom `http.Client` and passing one in during configuration is highly recommended as a default `http.Client` will be used. diff --git a/auth/http/http.go b/auth/http/http.go new file mode 100644 index 0000000..593e52f --- /dev/null +++ b/auth/http/http.go @@ -0,0 +1,190 @@ +package auth + +import ( + "bytes" + "encoding/json" + "errors" + "io" + "net/http" + "net/url" + "strconv" + + mqtt "github.com/mochi-mqtt/server/v2" + "github.com/mochi-mqtt/server/v2/packets" +) + +// Hook is a hook that makes http requests to an external service +type Hook struct { + httpClient *http.Client + aclhost *url.URL + clientauthhost *url.URL + superuserhost *url.URL // currently unused + callback func(resp *http.Response) bool + mqtt.HookBase +} + +// Options is a struct that contains all the information required to configure the http hook +// It is the responsibility of the configurer to pass a properly configured RoundTripper that takes +// care other requirements such as authentication, timeouts, retries, etc +type Options struct { + ACLHost *url.URL + SuperUserHost *url.URL + ClientAuthenticationHost *url.URL // currently unused + RoundTripper http.RoundTripper + Callback func(resp *http.Response) bool +} + +// ClientCheckPOST is the struct that is sent to the client authentication endpoint +type ClientCheckPOST struct { + ClientID string `json:"clientid"` + Password string `json:"password"` + Username string `json:"username"` +} + +// ACLCheckPOST is the struct that is sent to the acl endpoint +type ACLCheckPOST struct { + Username string `json:"username"` + ClientID string `json:"clientid"` + Topic string `json:"topic"` + ACC string `json:"acc"` +} + +// ID returns the ID of the hook +func (h *Hook) ID() string { + return "http-auth-hook" +} + +// Provides returns whether or not the hook provides the given hook +func (h *Hook) Provides(b byte) bool { + return bytes.Contains([]byte{ + mqtt.OnACLCheck, + mqtt.OnConnectAuthenticate, + }, []byte{b}) +} + +// Init initializes the hook with the given config +func (h *Hook) Init(config any) error { + if config == nil { + return errors.New("nil config") + } + + authHookConfig, ok := config.(Options) + if !ok { + return errors.New("improper config") + } + + if !validateConfig(authHookConfig) { + return errors.New("hostname configs failed validation") + } + + h.callback = defaultCallback + if authHookConfig.Callback != nil { + h.Log.Debug("replacing default callback with one included in options") + h.callback = authHookConfig.Callback + } + + h.httpClient = NewTransport(authHookConfig.RoundTripper) + + h.aclhost = authHookConfig.ACLHost + h.clientauthhost = authHookConfig.ClientAuthenticationHost + h.superuserhost = authHookConfig.SuperUserHost + return nil +} + +// OnConnectAuthenticate is called when a client attempts to connect to the server +func (h *Hook) OnConnectAuthenticate(cl *mqtt.Client, pk packets.Packet) bool { + + payload := ClientCheckPOST{ + ClientID: cl.ID, + Password: string(pk.Connect.Password), + Username: string(pk.Connect.Username), + } + + resp, err := h.makeRequest(http.MethodPost, h.clientauthhost, payload) + if err != nil { + h.Log.Error("error occurred while making http request", "error", err) + return false + } + + return h.callback(resp) +} + +// OnACLCheck is called when a client attempts to publish or subscribe to a topic +func (h *Hook) OnACLCheck(cl *mqtt.Client, topic string, write bool) bool { + + payload := ACLCheckPOST{ + ClientID: cl.ID, + Username: string(cl.Properties.Username), + Topic: topic, + ACC: strconv.FormatBool(write), + } + + resp, err := h.makeRequest(http.MethodPost, h.aclhost, payload) + if err != nil { + h.Log.Error("error occurred while making http request", "error", err) + return false + } + + return h.callback(resp) +} + +func (h *Hook) makeRequest(requestType string, url *url.URL, payload any) (*http.Response, error) { + var buffer io.Reader + if payload == nil { + buffer = http.NoBody + } else { + rb, err := json.Marshal(payload) + if err != nil { + return nil, err + } + buffer = bytes.NewBuffer(rb) + } + + req, err := http.NewRequest(requestType, url.String(), buffer) + if err != nil { + return nil, err + } + + resp, err := h.httpClient.Do(req) + if err != nil { + return nil, err + } + + return resp, nil +} + +func validateConfig(config Options) bool { + if (config.ACLHost == nil) || (config.ClientAuthenticationHost == nil) { + return false + } + return true +} + +// *************************************** + +// Transport represents everything required for adding to the roundtripper interface +type Transport struct { + OriginalTransport http.RoundTripper +} + +// NewTransport creates a new Transport object with any passed in information +func NewTransport(rt http.RoundTripper) *http.Client { + if rt == nil { + rt = &Transport{ + OriginalTransport: http.DefaultTransport, + } + } + + return &http.Client{ + Transport: rt, + } +} + +// RoundTrip goes through the HTTP RoundTrip implementation and attempts to add ASAP if not passed it +func (st *Transport) RoundTrip(r *http.Request) (*http.Response, error) { + return st.OriginalTransport.RoundTrip(r) +} + +func defaultCallback(resp *http.Response) bool { + return resp.StatusCode >= 200 && resp.StatusCode < 300 +} diff --git a/auth/http/http_test.go b/auth/http/http_test.go new file mode 100644 index 0000000..946709f --- /dev/null +++ b/auth/http/http_test.go @@ -0,0 +1,341 @@ +package auth + +import ( + "context" + "errors" + "log/slog" + "net/http" + "net/url" + "os" + "testing" + "time" + + gomock "github.com/golang/mock/gomock" + mqtt "github.com/mochi-mqtt/server/v2" + "github.com/mochi-mqtt/server/v2/packets" + "github.com/stretchr/testify/require" +) + +var defaultClientID = "default_client_id" + +func TestID(t *testing.T) { + authHook := new(Hook) + + require.Equal(t, "http-auth-hook", authHook.ID()) +} + +func TestProvides(t *testing.T) { + authHook := new(Hook) + + tests := []struct { + name string + hook byte + expectProvides bool + }{ + { + name: "Success - Provides OnACLCheck", + hook: mqtt.OnACLCheck, + expectProvides: true, + }, + { + name: "Success - Provides OnConnectAuthenticate", + hook: mqtt.OnConnectAuthenticate, + expectProvides: true, + }, + { + name: "Failure - Provides other hook", + hook: mqtt.OnClientExpired, + expectProvides: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + + require.Equal(t, tt.expectProvides, authHook.Provides(tt.hook)) + + }) + } +} + +func TestInit(t *testing.T) { + authHook := new(Hook) + authHook.Log = slog.Default() + + tests := []struct { + name string + config any + expectError bool + }{ + { + name: "Success - Proper config", + config: Options{ + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectError: false, + }, + { + name: "Success - Proper config - callback function", + config: Options{ + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + Callback: func(resp *http.Response) bool { return true }, + }, + expectError: false, + }, + { + name: "Failure - nil config", + config: nil, + expectError: true, + }, + { + name: "Failure - improper config", + config: "", + expectError: true, + }, + { + name: "Failure - hostname validation fail", + config: Options{}, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + + err := authHook.Init(tt.config) + if tt.expectError { + require.Error(t, err) + } + + }) + } +} + +func TestOnACLCheck(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mockRT := NewMockRoundTripper(ctrl) + + tests := []struct { + name string + config any + clientBlockMap map[string]time.Time + mocks func(ctx context.Context) + expectPass bool + }{ + { + name: "Success - Proper config", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: true, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusOK, + }, nil) + + }, + }, + { + name: "Success - Proper config - Timeout Configured - Not Blocked", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: true, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusOK, + }, nil) + + }, + }, + { + name: "Success - Proper config - Timeout Configured - Should Block", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: false, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusUnauthorized, + }, nil) + + }, + }, + { + name: "Success - Proper config - Timeout Configured - Should Delete Client From Block Map", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + clientBlockMap: map[string]time.Time{ + defaultClientID: time.Now().Add(-1 * time.Hour), + }, + expectPass: true, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusOK, + }, nil) + + }, + }, + { + name: "Error - HTTP error", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: false, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(nil, errors.New("Oh Crap")) + }, + }, + { + name: "Error - Non 2xx", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: false, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusTeapot, + }, nil) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ctx := context.Background() + tt.mocks(ctx) + + authHook := new(Hook) + authHook.Log = slog.New(slog.NewJSONHandler(os.Stdout, nil)) + authHook.Init(tt.config) + + success := authHook.OnACLCheck(&mqtt.Client{ + ID: defaultClientID, + }, "/topic", false) + + require.Equal(t, tt.expectPass, success) + }) + } +} + +func TestOnConnectAuthenticate(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mockRT := NewMockRoundTripper(ctrl) + + tests := []struct { + name string + config any + mocks func(ctx context.Context) + expectPass bool + }{ + { + name: "Success - Proper config", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: true, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusOK, + }, nil) + + }, + }, + { + name: "Success - Proper config - Timeout Configured - Not Blocked", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: true, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusOK, + }, nil) + + }, + }, + { + name: "Success - Proper config - Timeout Configured - Should Block", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: false, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusUnauthorized, + }, nil) + + }, + }, + { + name: "Error - HTTP error", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: false, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(nil, errors.New("Oh Crap")) + }, + }, + { + name: "Error - Non 2xx", + config: Options{ + RoundTripper: mockRT, + ACLHost: stringToURL("http://aclhost.com"), + ClientAuthenticationHost: stringToURL("http://clientauthenticationhost.com"), + }, + expectPass: false, + mocks: func(ctx context.Context) { + mockRT.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{ + StatusCode: http.StatusTeapot, + }, nil) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ctx := context.Background() + tt.mocks(ctx) + + authHook := new(Hook) + authHook.Log = slog.New(slog.NewJSONHandler(os.Stdout, nil)) + authHook.Init(tt.config) + + success := authHook.OnConnectAuthenticate(&mqtt.Client{ + ID: defaultClientID, + }, packets.Packet{}) + require.Equal(t, tt.expectPass, success) + }) + } +} + +func stringToURL(s string) *url.URL { + parsedURL, _ := url.Parse(s) + return parsedURL +} diff --git a/auth/http/mock_roundtripper.go b/auth/http/mock_roundtripper.go new file mode 100644 index 0000000..413f202 --- /dev/null +++ b/auth/http/mock_roundtripper.go @@ -0,0 +1,50 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: net/http (interfaces: RoundTripper) + +// Package assetattributor is a generated GoMock package. +package auth + +import ( + http "net/http" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" +) + +// MockRoundTripper is a mock of RoundTripper interface +type MockRoundTripper struct { + ctrl *gomock.Controller + recorder *MockRoundTripperMockRecorder +} + +// MockRoundTripperMockRecorder is the mock recorder for MockRoundTripper +type MockRoundTripperMockRecorder struct { + mock *MockRoundTripper +} + +// NewMockRoundTripper creates a new mock instance +func NewMockRoundTripper(ctrl *gomock.Controller) *MockRoundTripper { + mock := &MockRoundTripper{ctrl: ctrl} + mock.recorder = &MockRoundTripperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockRoundTripper) EXPECT() *MockRoundTripperMockRecorder { + return m.recorder +} + +// RoundTrip mocks base method +func (m *MockRoundTripper) RoundTrip(arg0 *http.Request) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RoundTrip", arg0) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RoundTrip indicates an expected call of RoundTrip +func (mr *MockRoundTripperMockRecorder) RoundTrip(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RoundTrip", reflect.TypeOf((*MockRoundTripper)(nil).RoundTrip), arg0) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..54562b9 --- /dev/null +++ b/go.mod @@ -0,0 +1,17 @@ +module github.com/mochi-mqtt/hooks + +go 1.21 + +require ( + github.com/golang/mock v1.6.0 + github.com/mochi-mqtt/server/v2 v2.4.1 + github.com/stretchr/testify v1.7.1 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rs/xid v1.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..88a5da9 --- /dev/null +++ b/go.sum @@ -0,0 +1,46 @@ +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/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= +github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/mochi-mqtt/server/v2 v2.4.1 h1:jNLtSz372+tq9TQLPnA20qz0cfdvwy5hJmnnU+nMBQM= +github.com/mochi-mqtt/server/v2 v2.4.1/go.mod h1:4axTIk4jcueKz7MSY9Z0y9w/RkF6ZEDbTCyatvho7lo= +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/rs/xid v1.4.0 h1:qd7wPTDkN6KQx2VmMBLrpHkiyQwgFXRnkOLacUiaSNY= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/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-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/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/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=