Add a --protocol-min-version option to router

To allow users to forgo compatibility with Weave Net 1.0 in order to
avoid #912, by setting --protocol-min-version=2.
Defaults to --protocol-min-version=1, i.e. compatible but vulnerable.
This commit is contained in:
David Wragg committed 2015-07-09 14:38:06 +01:00
1 parent 882f14d50c
commit 14d346db8b
5 files changed
+77 -65

No files matched your search

+16 -12
View File
@@ -33,10 +33,10 @@ func connPair() (ProtocolIntroConn, ProtocolIntroConn) {
return &a, &b
}
func doIntro(t *testing.T, ver byte, params ProtocolIntroParams) <-chan ProtocolIntroResults {
func doIntro(t *testing.T, params ProtocolIntroParams) <-chan ProtocolIntroResults {
ch := make(chan ProtocolIntroResults, 1)
go func() {
res, err := params.doIntro(ver)
res, err := params.DoIntro()
require.Nil(t, err)
ch <- res
}()
@@ -45,17 +45,21 @@ func doIntro(t *testing.T, ver byte, params ProtocolIntroParams) <-chan Protocol
func doProtocolIntro(t *testing.T, aver, bver byte, password []byte) byte {
aconn, bconn := connPair()
aresch := doIntro(t, aver, ProtocolIntroParams{
Features: map[string]string{"Name": "A"},
Conn: aconn,
Outbound: true,
Password: password,
aresch := doIntro(t, ProtocolIntroParams{
MinVersion: ProtocolMinVersion,
MaxVersion: aver,
Features: map[string]string{"Name": "A"},
Conn: aconn,
Outbound: true,
Password: password,
})
bresch := doIntro(t, bver, ProtocolIntroParams{
Features: map[string]string{"Name": "B"},
Conn: bconn,
Outbound: false,
Password: password,
bresch := doIntro(t, ProtocolIntroParams{
MinVersion: ProtocolMinVersion,
MaxVersion: bver,
Features: map[string]string{"Name": "B"},
Conn: bconn,
Outbound: false,
Password: password,
})
ares := <-aresch
bres := <-bresch