mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-16 14:08:09 +00:00
feat(p2p): allow to disable DHT and use only LAN (#2751)
This allows LocalAI to be less noisy avoiding to connect outside. Needed if e.g. there is no plan into using p2p across separate networks. Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
committed by
GitHub
parent
f120a0c9f9
commit
d5a56f04be
@ -348,11 +348,15 @@ func newNodeOpts(token string) ([]node.Option, error) {
|
||||
llger := logger.New(log.LevelFatal)
|
||||
defaultInterval := 10 * time.Second
|
||||
|
||||
// TODO: move this up, expose more config options when creating a node
|
||||
noDHT := os.Getenv("LOCALAI_P2P_DISABLE_DHT") == "true"
|
||||
noLimits := os.Getenv("LOCALAI_P2P_DISABLE_LIMITS") == "true"
|
||||
|
||||
loglevel := "info"
|
||||
|
||||
c := config.Config{
|
||||
Limit: config.ResourceLimit{
|
||||
Enable: true,
|
||||
Enable: !noLimits,
|
||||
MaxConns: 100,
|
||||
},
|
||||
NetworkToken: token,
|
||||
@ -372,7 +376,7 @@ func newNodeOpts(token string) ([]node.Option, error) {
|
||||
RateLimitInterval: defaultInterval,
|
||||
},
|
||||
Discovery: config.Discovery{
|
||||
DHT: true,
|
||||
DHT: noDHT,
|
||||
MDNS: true,
|
||||
Interval: 30 * time.Second,
|
||||
},
|
||||
|
Reference in New Issue
Block a user