Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

improve AutoRelay configuration, add config option for static relays #154

Merged
merged 3 commits into from
Nov 15, 2021
Merged
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
19 changes: 18 additions & 1 deletion swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ type SwarmConfig struct {
// EnableAutoRelay enables the "auto relay user" feature.
// Node will find and use advertised public relays when it determines that
// it's not reachable from the public internet.
//
// Deprecated: This flag is deprecated and is overriden by
// `Swarm.AutoRelay.Enabled` if specified.
EnableAutoRelay bool
marten-seemann marked this conversation as resolved.
Show resolved Hide resolved

// RelayService.* controls the "auto relay service" feature.
// AutoRelay controls the "auto relay service" feature.
// When enabled, the node will use relays if it is not publicly reachable.
AutoRelay AutoRelay
Copy link
Member

@lidel lidel Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried about ambiguity, better to be very clear around relay "service" and relay "client".
Would it be ok if we rename AutoRelay to more explicit RelayClient?

	RelayClient RelayClient

This way, we will have RelaySevice and RelayClient sections that are easier to wrap the head around without reading docs.

@marten-seemann Y/n? (I'm happy to apply changes)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this. @vyzo, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, fine by me.

Copy link
Member

@lidel lidel Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 4cb1c6f


// RelayService.* controls the "relay service".
// When enabled, node will provide a limited relay service to other peers.
RelayService RelayService

Expand All @@ -35,6 +42,16 @@ type SwarmConfig struct {
ConnMgr ConnMgr
}

type AutoRelay struct {
// Enables the AutoRelay.
Enabled Flag `json:",omitempty"`

// StaticRelays configures static relays to use when this node is not
// publicly reachable. If set, auto relay will not try to find any
// other relay servers.
StaticRelays []string `json:",omitempty"`
}

// RelayService configures the resources of the circuit v2 relay.
// For every field a reasonable default will be defined in go-ipfs.
type RelayService struct {
Expand Down