From 171d58d09fe67f89fb6ba9e32133427fa9794a39 Mon Sep 17 00:00:00 2001 From: Tyler Smith Date: Wed, 29 Jul 2020 14:44:40 -0700 Subject: TWEAK: Don't use IP filter. --- plugin/evm/vm.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugin/evm') diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index c710b9d..d6a7415 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -386,8 +386,8 @@ func (vm *VM) CreateHandlers() map[string]*commonEng.HTTPHandler { handler.RegisterName("admin", &admin.Performance{}) return map[string]*commonEng.HTTPHandler{ - "/rpc": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: newIPFilter(handler)}, - "/ws": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: newIPFilter(handler.WebsocketHandler([]string{"*"}))}, + "/rpc": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler}, + "/ws": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler.WebsocketHandler([]string{"*"})}, } } @@ -396,8 +396,8 @@ func (vm *VM) CreateStaticHandlers() map[string]*commonEng.HTTPHandler { handler := rpc.NewServer() handler.RegisterName("static", &StaticService{}) return map[string]*commonEng.HTTPHandler{ - "/rpc": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: newIPFilter(handler)}, - "/ws": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: newIPFilter(handler.WebsocketHandler([]string{"*"}))}, + "/rpc": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler}, + "/ws": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler.WebsocketHandler([]string{"*"})}, } } -- cgit v1.2.3-70-g09d2 From b974b98a356c7301de861136ae06c2955b655e3a Mon Sep 17 00:00:00 2001 From: Tyler Smith Date: Thu, 30 Jul 2020 21:41:23 -0700 Subject: CLEANUP: Remove unused IP filter. --- plugin/evm/vm.go | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'plugin/evm') diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index d6a7415..c275286 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -10,8 +10,6 @@ import ( "errors" "fmt" "math/big" - "net" - "net/http" "sync" "sync/atomic" "time" @@ -358,23 +356,6 @@ func (vm *VM) LastAccepted() ids.ID { return vm.lastAccepted.ID() } -type ipFilter struct { - handler http.Handler -} - -func (ipf ipFilter) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - if ips, _, err := net.SplitHostPort(request.RemoteAddr); err == nil && ips == "127.0.0.1" { - ipf.handler.ServeHTTP(writer, request) - return - } - writer.WriteHeader(404) - writer.Write([]byte("404 page not found\r\n")) -} - -func newIPFilter(handler http.Handler) http.Handler { - return ipFilter{handler} -} - // CreateHandlers makes new http handlers that can handle API calls func (vm *VM) CreateHandlers() map[string]*commonEng.HTTPHandler { handler := vm.chain.NewRPCHandler() -- cgit v1.2.3-70-g09d2