aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-08-03 17:24:31 -0400
committerDeterminant <[email protected]>2020-08-03 17:24:31 -0400
commit232173cbd4669223c7541fcb1d5ec77befaf2fdc (patch)
tree07a5b8852313a20ec5857313ed44c81b6f2146ae
parentc73ba009031126e16da6999468851b33f93e8005 (diff)
parent564cb79f16478b6b646a3c4508fc5b8b91f1ece2 (diff)
Merge remote-tracking branch 'origin/master' into master
-rw-r--r--plugin/evm/vm.go27
1 files changed, 4 insertions, 23 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 9fd6434..cf5ef8a 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()
@@ -386,8 +367,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 +377,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{"*"})},
}
}