diff --git a/cmd/ethereum/listener.go b/cmd/ethereum/listener.go index ccb9e6c..eb0a5e3 100644 --- a/cmd/ethereum/listener.go +++ b/cmd/ethereum/listener.go @@ -50,7 +50,7 @@ func StartListener(cfg config.Config, logger log.Logger, processingQueue chan *t } logger.Info(fmt.Sprintf( - "Starting listener at block %d looking back %d blocks", + "Starting Ethereum listener at block %d looking back %d blocks", cfg.Networks.Source.Ethereum.StartBlock, cfg.Networks.Source.Ethereum.LookbackPeriod)) diff --git a/cmd/root.go b/cmd/root.go index 732a6c8..ab0f333 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -66,7 +66,15 @@ func init() { } func startApi() { + gin.SetMode(gin.ReleaseMode) router := gin.Default() + + err := router.SetTrustedProxies(Cfg.Api.TrustedProxies) // vpn.primary.strange.love + if err != nil { + Logger.Error("unable to set trusted proxies on API server: " + err.Error()) + os.Exit(1) + } + router.GET("/tx/:txHash", getTxByHash) router.Run("localhost:8000") } diff --git a/config/config.go b/config/config.go index 267f798..f459e1d 100644 --- a/config/config.go +++ b/config/config.go @@ -43,8 +43,10 @@ type Config struct { FetchRetries int `yaml:"fetch-retries"` FetchRetryInterval int `yaml:"fetch-retry-interval"` } `yaml:"circle"` - ProcessorWorkerCount uint32 `yaml:"processor-worker-count"` + Api struct { + TrustedProxies []string `yaml:"trusted-proxies"` + } `yaml:"api"` } func Parse(file string) (cfg Config) { diff --git a/config/sample-app-config.yaml b/config/sample-app-config.yaml index 92a9a03..c1ececd 100644 --- a/config/sample-app-config.yaml +++ b/config/sample-app-config.yaml @@ -34,3 +34,6 @@ circle: fetch-retries: 10 # additional times to fetch an attestation fetch-retry-interval: 10 # time between retries in seconds processor-worker-count: 16 +api: + trusted-proxies: + - "1.2.3.4" # add trusted proxy IPs here \ No newline at end of file