Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: merge work (pithos testnet) #1530

Merged
merged 17 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/client/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ const args = require('yargs')
describe: 'RLPx listening port',
default: Config.PORT_DEFAULT,
},
extIP: {
describe: 'RLPx external IP (default: localhost)',
string: true,
},
holgerd77 marked this conversation as resolved.
Show resolved Hide resolved
multiaddrs: {
describe: 'Network multiaddrs',
array: true,
Expand Down Expand Up @@ -515,6 +519,7 @@ async function run() {
transports: args.transports,
bootnodes: args.bootnodes ? parseMultiaddrs(args.bootnodes) : undefined,
port: args.port,
extIP: args.extIP,
multiaddrs: args.multiaddrs ? parseMultiaddrs(args.multiaddrs) : undefined,
rpc: args.rpc,
rpcport: args.rpcport,
Expand Down
9 changes: 9 additions & 0 deletions packages/client/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ export interface ConfigOptions {
*/
port?: number

/**
* RLPx external IP
*
* Default: `localhost`
*/
extIP?: string

/**
* Network multiaddrs for libp2p
* (e.g. /ip4/127.0.0.1/tcp/50505/p2p/QmABC)
Expand Down Expand Up @@ -261,6 +268,7 @@ export class Config {
public readonly transports: string[]
public readonly bootnodes?: Multiaddr[]
public readonly port?: number
public readonly extIP?: string
public readonly multiaddrs?: Multiaddr[]
public readonly rpc: boolean
public readonly rpcport: number
Expand Down Expand Up @@ -299,6 +307,7 @@ export class Config {
this.transports = options.transports ?? Config.TRANSPORTS_DEFAULT
this.bootnodes = options.bootnodes
this.port = options.port ?? Config.PORT_DEFAULT
this.extIP = options.extIP
this.multiaddrs = options.multiaddrs
this.datadir = options.datadir ?? Config.DATADIR_DEFAULT
this.key = options.key ?? genPrivateKey()
Expand Down
3 changes: 1 addition & 2 deletions packages/client/lib/net/server/rlpxserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export class RlpxServer extends Server {
constructor(options: RlpxServerOptions) {
super(options)

// TODO: get the external ip from the upnp service
this.ip = '::'
this.ip = options.config.extIP ?? '::'
this.discovery = options.config.discV4 || options.config.discDns
this.clientFilter = options.clientFilter ?? [
'go1.5',
Expand Down