mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-04 17:52: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/protocol"
|
||||||
"github.com/mudler/edgevpn/pkg/services"
|
"github.com/mudler/edgevpn/pkg/services"
|
||||||
"github.com/mudler/edgevpn/pkg/types"
|
"github.com/mudler/edgevpn/pkg/types"
|
||||||
|
eutils "github.com/mudler/edgevpn/pkg/utils"
|
||||||
"github.com/phayes/freeport"
|
"github.com/phayes/freeport"
|
||||||
zlog "github.com/rs/zerolog/log"
|
zlog "github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/mudler/edgevpn/pkg/logger"
|
"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 {
|
func GenerateToken() string {
|
||||||
// Generates a new config and exit
|
// Generates a new config and exit
|
||||||
newData := node.GenerateNewConnectionData(120)
|
return generateNewConnectionData().Base64()
|
||||||
return newData.Base64()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsP2PEnabled() bool {
|
func IsP2PEnabled() bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user