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

add preferredPort (default 13331) to core opts #101

Merged
merged 2 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var cabal = Cabal(storage, key, { db: level('/tmp/bot.db') })

Other `opts` include:

- `opts.preferredPort`: controls the port cabal listens on. defaults to port `13331`.
- `opts.modKeys`: an array of keys to be considered moderators from this user's perspective.
- `opts.adminKeys`: an array of keys to be considered administrators from this user's perspective.

Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function Cabal (storage, key, opts) {
this.maxFeeds = opts.maxFeeds
this.modKeys = opts.modKeys || []
this.adminKeys = opts.adminKeys || []
this.preferredPort = opts.preferredPort || 13331

if (!key) this.key = generateKeyHex()
else {
Expand Down
3 changes: 2 additions & 1 deletion swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module.exports = function (cabal, opts, cb) {

const discoveryKey = crypto.discoveryKey(Buffer.from(cabal.key, 'hex'))

const swarm = hyperswarm()
const { preferredPort } = cabal
const swarm = hyperswarm({ preferredPort })
swarm.join(discoveryKey, {
lookup: true,
announce: true
Expand Down