-
Notifications
You must be signed in to change notification settings - Fork 0
/
providerserver.go
31 lines (27 loc) · 906 Bytes
/
providerserver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package config
type ProviderServer struct {
// ListenMultiaddr is the multiaddr string for the node's listen address
ListenMultiaddr string
// ControlAddr is where to run the http control server
ControlAddr string
// RetrievalMultiaddrs are the addresses to advertise for data retrieval.
// Defaults to the provider's libp2p host listen addresses.
RetrievalMultiaddrs []string
}
// NewProviderServer instantiates a new ProviderServer config with default values.
func NewProviderServer() ProviderServer {
return ProviderServer{
ListenMultiaddr: "/ip4/0.0.0.0/tcp/3103",
ControlAddr: ":3104",
}
}
// PopulateDefaults replaces zero-values in the config with default values.
func (c *ProviderServer) PopulateDefaults() {
def := NewProviderServer()
if c.ListenMultiaddr == "" {
c.ListenMultiaddr = def.ListenMultiaddr
}
if c.ControlAddr == "" {
c.ControlAddr = def.ControlAddr
}
}