Skip to content

Commit

Permalink
Merge pull request #50 from NodeFactoryIo/dev
Browse files Browse the repository at this point in the history
Release v0.3.0
  • Loading branch information
mpetrunic committed Dec 10, 2020
2 parents 203a5de + 0a20b79 commit 65d8ca0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
GO111MODULE: "on"
steps:
- name: Install Go
uses: actions/setup-go@v2-beta
uses: actions/setup-go@v2.1.3
with:
go-version: 1.14.x

Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.2.0
version=0.3.0
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [unreleased](https://github.com/NodeFactoryIo/vedran-daemon/tree/HEAD)

[Full Changelog](https://github.com/NodeFactoryIo/vedran-daemon/compare/v0.3.0...HEAD)

## [v0.3.0](https://github.com/NodeFactoryIo/vedran-daemon/tree/v0.3.0)

[Full Changelog](https://github.com/NodeFactoryIo/vedran-daemon/compare/v0.2.0...v0.3.0)

### Fixed

### Added
- Added websocket support [\#49](https://github.com/NodeFactoryIo/vedran-daemon/pull/49) ([mpetrun5](https://github.com/mpetrun5))

### Changed


## [v0.2.0](https://github.com/NodeFactoryIo/vedran-daemon/tree/v0.2.0)

[Full Changelog](https://github.com/NodeFactoryIo/vedran-daemon/compare/v0.1.2...v0.2.0)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Flags:
--log-level string Level of logging (eg. debug, info, warn, error) (default "info")
--node-metrics string Polkadot node metrics url (default "localhost:9615")
--node-rpc string Polkadot node rpc url (default "localhost:9933")
--node-ws string Polkadot node ws url (default "localhost:9944")
--payout-address string Payout address to which reward tokens will be sent (required)
```
## Starting daemon
Expand Down Expand Up @@ -79,6 +80,8 @@ node and load balancer on registration which communicate via daemon used as a pr

`--node-rpc` - local url to node rpc endpoint - **DEFAULT** [http://localhost:9933]

`--node-ws` - local url to node websocket rpc endpoint - **DEFAULT** [http://localhost:9944]

## Development


Expand Down
9 changes: 9 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ var (
logLevel string
logFile string
nodeRPCURL string
nodeWSURL string
nodeMetricsURL string
id string
lbBaseURL string
payoutAddress string
lbURL *url.URL
metricsURL *url.URL
rpcURL *url.URL
wsURL *url.URL
)

var startCmd = &cobra.Command{
Expand Down Expand Up @@ -62,12 +64,18 @@ var startCmd = &cobra.Command{
return fmt.Errorf("Failed parsing rpc url: %v", err)
}

wsURL, err = url.Parse(nodeWSURL)
if err != nil {
return fmt.Errorf("Failed parsing ws url: %v", err)
}

return nil
},
}

func init() {
startCmd.Flags().StringVar(&nodeRPCURL, "node-rpc", "http://localhost:9933", "Polkadot node rpc url")
startCmd.Flags().StringVar(&nodeWSURL, "node-ws", "http://localhost:9944", "Polkadot node websocket url")
startCmd.Flags().StringVar(&nodeMetricsURL, "node-metrics", "http://localhost:9615", "Polkadot node metrics url")
startCmd.Flags().StringVar(&id, "id", "", "Vedran-daemon id string (required)")
startCmd.Flags().StringVar(&lbBaseURL, "lb", "", "Target load balancer url (required)")
Expand All @@ -88,6 +96,7 @@ func start(cmd *cobra.Command, _ []string) error {
telemetry := telemetry.NewTelemetry()
tunnel := &tunnel.Tunnel{
NodeRPCURL: rpcURL,
NodeWSURL: wsURL,
}

err := run.Start(tunnel, lbClient, nodeClient, telemetry, id, payoutAddress)
Expand Down
8 changes: 7 additions & 1 deletion internal/tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
// Tunnel is tunnel connection with load balancer
type Tunnel struct {
NodeRPCURL *url.URL
NodeWSURL *url.URL
}

// Tunneler defines methods for connecting to load balancer tunnel
Expand All @@ -35,11 +36,16 @@ func (t *Tunnel) StartTunnel(nodeID string, tunnelServerAddress string, token st
c, err := client.NewClient(&client.ClientConfig{
ServerAddress: tunnelServerAddress,
Tunnels: map[string]*client.Tunnel{
"default": {
"http": {
Protocol: Protocol,
Addr: t.NodeRPCURL.Host,
RemoteAddr: RemoteAddr,
},
"ws": {
Protocol: Protocol,
Addr: t.NodeWSURL.Host,
RemoteAddr: RemoteAddr,
},
},
Logger: log.NewEntry(log.New()),
AuthToken: token,
Expand Down

0 comments on commit 65d8ca0

Please sign in to comment.