Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/config, lib/connections: Configurable protocol priority (ref #8626)…
… (#8868) This makes the various protocol priorities configurable among the other options. With this, it's possible to prefer QUIC over TCP for WAN connections, for example. Both sides need to be similarly configured for this to work properly. The default priority order remains the same as previously (TCP, QUIC, Relay, with LAN better than WAN). To make this happen I made each dialer & listener more priority aware, and moved the check for whether a connection is LAN or not into the dialer / listener -- this is the new "lanChecker" type that's passed around.
- Loading branch information
Showing
16 changed files
with
622 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,44 +47,49 @@ func TestDefaultValues(t *testing.T) { | |
Version: CurrentVersion, | ||
Folders: []FolderConfiguration{}, | ||
Options: OptionsConfiguration{ | ||
RawListenAddresses: []string{"default"}, | ||
RawGlobalAnnServers: []string{"default"}, | ||
GlobalAnnEnabled: true, | ||
LocalAnnEnabled: true, | ||
LocalAnnPort: 21027, | ||
LocalAnnMCAddr: "[ff12::8384]:21027", | ||
MaxSendKbps: 0, | ||
MaxRecvKbps: 0, | ||
ReconnectIntervalS: 60, | ||
RelaysEnabled: true, | ||
RelayReconnectIntervalM: 10, | ||
StartBrowser: true, | ||
NATEnabled: true, | ||
NATLeaseM: 60, | ||
NATRenewalM: 30, | ||
NATTimeoutS: 10, | ||
AutoUpgradeIntervalH: 12, | ||
KeepTemporariesH: 24, | ||
CacheIgnoredFiles: false, | ||
ProgressUpdateIntervalS: 5, | ||
LimitBandwidthInLan: false, | ||
MinHomeDiskFree: Size{1, "%"}, | ||
URURL: "https://data.syncthing.net/newdata", | ||
URInitialDelayS: 1800, | ||
URPostInsecurely: false, | ||
ReleasesURL: "https://upgrades.syncthing.net/meta.json", | ||
AlwaysLocalNets: []string{}, | ||
OverwriteRemoteDevNames: false, | ||
TempIndexMinBlocks: 10, | ||
UnackedNotificationIDs: []string{"authenticationUserAndPassword"}, | ||
SetLowPriority: true, | ||
CRURL: "https://crash.syncthing.net/newcrash", | ||
CREnabled: true, | ||
StunKeepaliveStartS: 180, | ||
StunKeepaliveMinS: 20, | ||
RawStunServers: []string{"default"}, | ||
AnnounceLANAddresses: true, | ||
FeatureFlags: []string{}, | ||
RawListenAddresses: []string{"default"}, | ||
RawGlobalAnnServers: []string{"default"}, | ||
GlobalAnnEnabled: true, | ||
LocalAnnEnabled: true, | ||
LocalAnnPort: 21027, | ||
LocalAnnMCAddr: "[ff12::8384]:21027", | ||
MaxSendKbps: 0, | ||
MaxRecvKbps: 0, | ||
ReconnectIntervalS: 60, | ||
RelaysEnabled: true, | ||
RelayReconnectIntervalM: 10, | ||
StartBrowser: true, | ||
NATEnabled: true, | ||
NATLeaseM: 60, | ||
NATRenewalM: 30, | ||
NATTimeoutS: 10, | ||
AutoUpgradeIntervalH: 12, | ||
KeepTemporariesH: 24, | ||
CacheIgnoredFiles: false, | ||
ProgressUpdateIntervalS: 5, | ||
LimitBandwidthInLan: false, | ||
MinHomeDiskFree: Size{1, "%"}, | ||
URURL: "https://data.syncthing.net/newdata", | ||
URInitialDelayS: 1800, | ||
URPostInsecurely: false, | ||
ReleasesURL: "https://upgrades.syncthing.net/meta.json", | ||
AlwaysLocalNets: []string{}, | ||
OverwriteRemoteDevNames: false, | ||
TempIndexMinBlocks: 10, | ||
UnackedNotificationIDs: []string{"authenticationUserAndPassword"}, | ||
SetLowPriority: true, | ||
CRURL: "https://crash.syncthing.net/newcrash", | ||
CREnabled: true, | ||
StunKeepaliveStartS: 180, | ||
StunKeepaliveMinS: 20, | ||
RawStunServers: []string{"default"}, | ||
AnnounceLANAddresses: true, | ||
FeatureFlags: []string{}, | ||
ConnectionPriorityTCPLAN: 10, | ||
ConnectionPriorityQUICLAN: 20, | ||
ConnectionPriorityTCPWAN: 30, | ||
ConnectionPriorityQUICWAN: 40, | ||
ConnectionPriorityRelay: 50, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
calmh
Author
Member
|
||
}, | ||
Defaults: Defaults{ | ||
Folder: FolderConfiguration{ | ||
|
@@ -239,45 +244,50 @@ func TestNoListenAddresses(t *testing.T) { | |
|
||
func TestOverriddenValues(t *testing.T) { | ||
expected := OptionsConfiguration{ | ||
RawListenAddresses: []string{"tcp://:23000"}, | ||
RawGlobalAnnServers: []string{"udp4://syncthing.nym.se:22026"}, | ||
GlobalAnnEnabled: false, | ||
LocalAnnEnabled: false, | ||
LocalAnnPort: 42123, | ||
LocalAnnMCAddr: "quux:3232", | ||
MaxSendKbps: 1234, | ||
MaxRecvKbps: 2341, | ||
ReconnectIntervalS: 6000, | ||
RelaysEnabled: false, | ||
RelayReconnectIntervalM: 20, | ||
StartBrowser: false, | ||
NATEnabled: false, | ||
NATLeaseM: 90, | ||
NATRenewalM: 15, | ||
NATTimeoutS: 15, | ||
AutoUpgradeIntervalH: 24, | ||
KeepTemporariesH: 48, | ||
CacheIgnoredFiles: true, | ||
ProgressUpdateIntervalS: 10, | ||
LimitBandwidthInLan: true, | ||
MinHomeDiskFree: Size{5.2, "%"}, | ||
URSeen: 8, | ||
URAccepted: 4, | ||
URURL: "https://localhost/newdata", | ||
URInitialDelayS: 800, | ||
URPostInsecurely: true, | ||
ReleasesURL: "https://localhost/releases", | ||
AlwaysLocalNets: []string{}, | ||
OverwriteRemoteDevNames: true, | ||
TempIndexMinBlocks: 100, | ||
UnackedNotificationIDs: []string{"asdfasdf"}, | ||
SetLowPriority: false, | ||
CRURL: "https://localhost/newcrash", | ||
CREnabled: false, | ||
StunKeepaliveStartS: 9000, | ||
StunKeepaliveMinS: 900, | ||
RawStunServers: []string{"foo"}, | ||
FeatureFlags: []string{"feature"}, | ||
RawListenAddresses: []string{"tcp://:23000"}, | ||
RawGlobalAnnServers: []string{"udp4://syncthing.nym.se:22026"}, | ||
GlobalAnnEnabled: false, | ||
LocalAnnEnabled: false, | ||
LocalAnnPort: 42123, | ||
LocalAnnMCAddr: "quux:3232", | ||
MaxSendKbps: 1234, | ||
MaxRecvKbps: 2341, | ||
ReconnectIntervalS: 6000, | ||
RelaysEnabled: false, | ||
RelayReconnectIntervalM: 20, | ||
StartBrowser: false, | ||
NATEnabled: false, | ||
NATLeaseM: 90, | ||
NATRenewalM: 15, | ||
NATTimeoutS: 15, | ||
AutoUpgradeIntervalH: 24, | ||
KeepTemporariesH: 48, | ||
CacheIgnoredFiles: true, | ||
ProgressUpdateIntervalS: 10, | ||
LimitBandwidthInLan: true, | ||
MinHomeDiskFree: Size{5.2, "%"}, | ||
URSeen: 8, | ||
URAccepted: 4, | ||
URURL: "https://localhost/newdata", | ||
URInitialDelayS: 800, | ||
URPostInsecurely: true, | ||
ReleasesURL: "https://localhost/releases", | ||
AlwaysLocalNets: []string{}, | ||
OverwriteRemoteDevNames: true, | ||
TempIndexMinBlocks: 100, | ||
UnackedNotificationIDs: []string{"asdfasdf"}, | ||
SetLowPriority: false, | ||
CRURL: "https://localhost/newcrash", | ||
CREnabled: false, | ||
StunKeepaliveStartS: 9000, | ||
StunKeepaliveMinS: 900, | ||
RawStunServers: []string{"foo"}, | ||
FeatureFlags: []string{"feature"}, | ||
ConnectionPriorityTCPLAN: 40, | ||
ConnectionPriorityQUICLAN: 45, | ||
ConnectionPriorityTCPWAN: 50, | ||
ConnectionPriorityQUICWAN: 55, | ||
ConnectionPriorityRelay: 9000, | ||
} | ||
expectedPath := "/media/syncthing" | ||
|
||
|
@@ -514,7 +524,7 @@ func TestFolderCheckPath(t *testing.T) { | |
n := t.TempDir() | ||
testFs := fs.NewFilesystem(fs.FilesystemTypeBasic, n) | ||
|
||
err := os.MkdirAll(filepath.Join(n, "dir", ".stfolder"), os.FileMode(0777)) | ||
err := os.MkdirAll(filepath.Join(n, "dir", ".stfolder"), os.FileMode(0o777)) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I know it's too late, but this should have been it's own struct.
Or potentially even a struct of string to int mappings.