master
go 54 lines 2.35 KB
Raw
1 package config
2
3 import (
4 "time"
5
6 p2pforge "github.com/ipshipyard/p2p-forge/client"
7 )
8
9 // AutoTLS includes optional configuration of p2p-forge client of service
10 // for obtaining a domain and TLS certificate to improve connectivity for web
11 // browser clients. More: https://github.com/ipshipyard/p2p-forge#readme
12 type AutoTLS struct {
13 // Enables the p2p-forge feature and all related features.
14 Enabled Flag `json:",omitempty"`
15
16 // Optional, controls if Kubo should add /tls/sni/.../ws listener to every /tcp port if no explicit /ws is defined in Addresses.Swarm
17 AutoWSS Flag `json:",omitempty"`
18
19 // Optional, controls whether to skip network DNS lookups for p2p-forge domains.
20 // Applies to resolution via DNS.Resolvers, including /dns* multiaddrs in go-libp2p.
21 // When enabled (default), A/AAAA queries for *.libp2p.direct are resolved
22 // locally by parsing the IP directly from the hostname, avoiding network I/O.
23 // Set to false to always use network DNS (useful for debugging).
24 SkipDNSLookup Flag `json:",omitempty"`
25
26 // Optional override of the parent domain that will be used
27 DomainSuffix *OptionalString `json:",omitempty"`
28
29 // Optional override of HTTP API that acts as ACME DNS-01 Challenge broker
30 RegistrationEndpoint *OptionalString `json:",omitempty"`
31
32 // Optional Authorization token, used with private/test instances of p2p-forge
33 RegistrationToken *OptionalString `json:",omitempty"`
34
35 // Optional registration delay used when AutoTLS.Enabled is not explicitly set to true in config
36 RegistrationDelay *OptionalDuration `json:",omitempty"`
37
38 // Optional override of CA ACME API used by p2p-forge system
39 CAEndpoint *OptionalString `json:",omitempty"`
40
41 // Optional, controls if features like AutoWSS should generate shorter /dnsX instead of /ipX/../sni/..
42 ShortAddrs Flag `json:",omitempty"`
43 }
44
45 const (
46 DefaultAutoTLSEnabled = true // with DefaultAutoTLSRegistrationDelay, unless explicitly enabled in config
47 DefaultDomainSuffix = p2pforge.DefaultForgeDomain
48 DefaultRegistrationEndpoint = p2pforge.DefaultForgeEndpoint
49 DefaultCAEndpoint = p2pforge.DefaultCAEndpoint
50 DefaultAutoWSS = true // requires AutoTLS.Enabled
51 DefaultAutoTLSShortAddrs = true // requires AutoTLS.Enabled
52 DefaultAutoTLSSkipDNSLookup = true // skip network DNS for p2p-forge domains
53 DefaultAutoTLSRegistrationDelay = 1 * time.Hour
54 )