mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-19 04:37:53 +00:00
chore(p2p): customize defaults
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
d58f9c333b
commit
e4c696d966
@ -21,16 +21,40 @@ import (
|
||||
"github.com/mudler/edgevpn/pkg/protocol"
|
||||
"github.com/mudler/edgevpn/pkg/services"
|
||||
"github.com/mudler/edgevpn/pkg/types"
|
||||
eutils "github.com/mudler/edgevpn/pkg/utils"
|
||||
"github.com/phayes/freeport"
|
||||
zlog "github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/mudler/edgevpn/pkg/logger"
|
||||
)
|
||||
|
||||
func generateNewConnectionData() *node.YAMLConnectionConfig {
|
||||
maxMessSize := 20 << 20 // 20MB
|
||||
keyLength := 43
|
||||
|
||||
return &node.YAMLConnectionConfig{
|
||||
MaxMessageSize: maxMessSize,
|
||||
RoomName: eutils.RandStringRunes(keyLength),
|
||||
Rendezvous: eutils.RandStringRunes(keyLength),
|
||||
MDNS: eutils.RandStringRunes(keyLength),
|
||||
OTP: node.OTP{
|
||||
DHT: node.OTPConfig{
|
||||
Key: eutils.RandStringRunes(keyLength),
|
||||
Interval: 120,
|
||||
Length: keyLength,
|
||||
},
|
||||
Crypto: node.OTPConfig{
|
||||
Key: eutils.RandStringRunes(keyLength),
|
||||
Interval: 9000,
|
||||
Length: keyLength,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateToken() string {
|
||||
// Generates a new config and exit
|
||||
newData := node.GenerateNewConnectionData(120)
|
||||
return newData.Base64()
|
||||
return generateNewConnectionData().Base64()
|
||||
}
|
||||
|
||||
func IsP2PEnabled() bool {
|
||||
|
Loading…
Reference in New Issue
Block a user