@cryptotaxi247 / kubo / commits / 151c8dcf4

go-ipfs-config: conifg-patch: apply review

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Sep 22, 2017 at 00:13 UTC 151c8dcf4e4a7c9b3f31fd79ad550e5feb4970f5
1 file changed +4
config/profile.go
+4
@@ -1,7 +1,9 @@
1 package config
2
3 +// Transformer is a function which takes configuration and applies some filter to it
4 type Transformer func(c *Config) error
5
6 +// Profile applies some set of changes to the configuration
7 type Profile struct {
8 Apply Transformer
9 Unapply Transformer
@@ -32,11 +34,13 @@ var Profiles = map[string]*Profile{
34 "/ip4/240.0.0.0/ipcidr/4",
35 }
36
37 + c.Addresses.NoAnnounce = append(c.Addresses.NoAnnounce, defaultServerFilters...)
38 c.Swarm.AddrFilters = append(c.Swarm.AddrFilters, defaultServerFilters...)
39 c.Discovery.MDNS.Enabled = false
40 return nil
41 },
42 Unapply: func(c *Config) error {
43 + c.Addresses.NoAnnounce = []string{}
44 c.Swarm.AddrFilters = []string{}
45 c.Discovery.MDNS.Enabled = true
46 return nil