forked from celestiaorg/celestia-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gateway): reenabling gateway, adding flag to enable (celestiaorg…
…#1199) It adds the gateway back onto the node (closes celestiaorg#1182) with it's own config, disabled by default, which is activated by the flag `--gateway` (closes celestiaorg#1183).
- Loading branch information
Ryan
authored
Oct 28, 2022
1 parent
fb17d24
commit c537ec4
Showing
13 changed files
with
254 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package gateway | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"strconv" | ||
) | ||
|
||
type Config struct { | ||
Address string | ||
Port string | ||
Enabled bool | ||
} | ||
|
||
func DefaultConfig() Config { | ||
return Config{ | ||
Address: "0.0.0.0", | ||
// do NOT expose the same port as celestia-core by default so that both can run on the same machine | ||
Port: "26659", | ||
Enabled: false, | ||
} | ||
} | ||
|
||
func (cfg *Config) Validate() error { | ||
if ip := net.ParseIP(cfg.Address); ip == nil { | ||
return fmt.Errorf("gateway: invalid listen address format: %s", cfg.Address) | ||
} | ||
_, err := strconv.Atoi(cfg.Port) | ||
if err != nil { | ||
return fmt.Errorf("gateway: invalid port: %s", err.Error()) | ||
} | ||
return nil | ||
} |
Oops, something went wrong.