mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 01:07:41 +08:00
add MTU to wireguard conf
This commit is contained in:
@@ -331,6 +331,9 @@ func WriteWgConfig(node *models.Node, privateKey string, peers []wgtypes.PeerCon
|
|||||||
if node.PostDown != "" {
|
if node.PostDown != "" {
|
||||||
wireguard.Section(section_interface).Key("PostDown").SetValue(node.PostDown)
|
wireguard.Section(section_interface).Key("PostDown").SetValue(node.PostDown)
|
||||||
}
|
}
|
||||||
|
if node.MTU != 0 {
|
||||||
|
wireguard.Section(section_interface).Key("MTU").SetValue(strconv.FormatInt(int64(node.MTU), 10))
|
||||||
|
}
|
||||||
for i, peer := range peers {
|
for i, peer := range peers {
|
||||||
wireguard.SectionWithIndex(section_peers, i).Key("PublicKey").SetValue(peer.PublicKey.String())
|
wireguard.SectionWithIndex(section_peers, i).Key("PublicKey").SetValue(peer.PublicKey.String())
|
||||||
if peer.PresharedKey != nil {
|
if peer.PresharedKey != nil {
|
||||||
@@ -430,6 +433,9 @@ func UpdateWgInterface(file, privateKey, nameserver string, node models.Node) er
|
|||||||
if node.PostDown != "" {
|
if node.PostDown != "" {
|
||||||
wireguard.Section(section_interface).Key("PostDown").SetValue(node.PostDown)
|
wireguard.Section(section_interface).Key("PostDown").SetValue(node.PostDown)
|
||||||
}
|
}
|
||||||
|
if node.MTU != 0 {
|
||||||
|
wireguard.Section(section_interface).Key("MTU").SetValue(strconv.FormatInt(int64(node.MTU), 10))
|
||||||
|
}
|
||||||
if err := wireguard.SaveTo(file); err != nil {
|
if err := wireguard.SaveTo(file); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user