Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
7c0abb35
Unverified
Commit
7c0abb35
authored
Jun 28, 2020
by
Janoš Guljaš
Committed by
GitHub
Jun 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable QUIC and WS libp2p transports by default (#390)
parent
10a3881e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
23 deletions
+23
-23
start.go
cmd/bee/cmd/start.go
+6
-6
node.go
pkg/node/node.go
+4
-4
connections_test.go
pkg/p2p/libp2p/connections_test.go
+5
-5
libp2p.go
pkg/p2p/libp2p/libp2p.go
+8
-8
No files found.
cmd/bee/cmd/start.go
View file @
7c0abb35
...
@@ -33,8 +33,8 @@ func (c *command) initStartCmd() (err error) {
...
@@ -33,8 +33,8 @@ func (c *command) initStartCmd() (err error) {
optionNameAPIAddr
=
"api-addr"
optionNameAPIAddr
=
"api-addr"
optionNameP2PAddr
=
"p2p-addr"
optionNameP2PAddr
=
"p2p-addr"
optionNameNATAddr
=
"nat-addr"
optionNameNATAddr
=
"nat-addr"
optionNameP2P
DisableWS
=
"p2p-dis
able-ws"
optionNameP2P
EnableWS
=
"p2p-en
able-ws"
optionNameP2P
DisableQUIC
=
"p2p-dis
able-quic"
optionNameP2P
EnableQUIC
=
"p2p-en
able-quic"
optionNameEnableDebugAPI
=
"enable-debug-api"
optionNameEnableDebugAPI
=
"enable-debug-api"
optionNameDebugAPIAddr
=
"debug-api-addr"
optionNameDebugAPIAddr
=
"debug-api-addr"
optionNameBootnodes
=
"bootnode"
optionNameBootnodes
=
"bootnode"
...
@@ -119,8 +119,8 @@ Welcome to the Swarm.... Bzzz Bzzzz Bzzzz
...
@@ -119,8 +119,8 @@ Welcome to the Swarm.... Bzzz Bzzzz Bzzzz
DebugAPIAddr
:
debugAPIAddr
,
DebugAPIAddr
:
debugAPIAddr
,
Addr
:
c
.
config
.
GetString
(
optionNameP2PAddr
),
Addr
:
c
.
config
.
GetString
(
optionNameP2PAddr
),
NATAddr
:
c
.
config
.
GetString
(
optionNameNATAddr
),
NATAddr
:
c
.
config
.
GetString
(
optionNameNATAddr
),
DisableWS
:
c
.
config
.
GetBool
(
optionNameP2PDis
ableWS
),
EnableWS
:
c
.
config
.
GetBool
(
optionNameP2PEn
ableWS
),
DisableQUIC
:
c
.
config
.
GetBool
(
optionNameP2PDis
ableQUIC
),
EnableQUIC
:
c
.
config
.
GetBool
(
optionNameP2PEn
ableQUIC
),
NetworkID
:
c
.
config
.
GetUint64
(
optionNameNetworkID
),
NetworkID
:
c
.
config
.
GetUint64
(
optionNameNetworkID
),
WelcomeMessage
:
c
.
config
.
GetString
(
optionWelcomeMessage
),
WelcomeMessage
:
c
.
config
.
GetString
(
optionWelcomeMessage
),
Bootnodes
:
c
.
config
.
GetStringSlice
(
optionNameBootnodes
),
Bootnodes
:
c
.
config
.
GetStringSlice
(
optionNameBootnodes
),
...
@@ -180,8 +180,8 @@ Welcome to the Swarm.... Bzzz Bzzzz Bzzzz
...
@@ -180,8 +180,8 @@ Welcome to the Swarm.... Bzzz Bzzzz Bzzzz
cmd
.
Flags
()
.
String
(
optionNameAPIAddr
,
":8080"
,
"HTTP API listen address"
)
cmd
.
Flags
()
.
String
(
optionNameAPIAddr
,
":8080"
,
"HTTP API listen address"
)
cmd
.
Flags
()
.
String
(
optionNameP2PAddr
,
":7070"
,
"P2P listen address"
)
cmd
.
Flags
()
.
String
(
optionNameP2PAddr
,
":7070"
,
"P2P listen address"
)
cmd
.
Flags
()
.
String
(
optionNameNATAddr
,
""
,
"NAT exposed address"
)
cmd
.
Flags
()
.
String
(
optionNameNATAddr
,
""
,
"NAT exposed address"
)
cmd
.
Flags
()
.
Bool
(
optionNameP2P
Dis
ableWS
,
false
,
"disable P2P WebSocket protocol"
)
cmd
.
Flags
()
.
Bool
(
optionNameP2P
En
ableWS
,
false
,
"disable P2P WebSocket protocol"
)
cmd
.
Flags
()
.
Bool
(
optionNameP2P
Dis
ableQUIC
,
false
,
"disable P2P QUIC protocol"
)
cmd
.
Flags
()
.
Bool
(
optionNameP2P
En
ableQUIC
,
false
,
"disable P2P QUIC protocol"
)
cmd
.
Flags
()
.
StringSlice
(
optionNameBootnodes
,
[]
string
{
"/dnsaddr/bootnode.ethswarm.org"
},
"initial nodes to connect to"
)
cmd
.
Flags
()
.
StringSlice
(
optionNameBootnodes
,
[]
string
{
"/dnsaddr/bootnode.ethswarm.org"
},
"initial nodes to connect to"
)
cmd
.
Flags
()
.
Bool
(
optionNameEnableDebugAPI
,
false
,
"enable debug HTTP API"
)
cmd
.
Flags
()
.
Bool
(
optionNameEnableDebugAPI
,
false
,
"enable debug HTTP API"
)
cmd
.
Flags
()
.
String
(
optionNameDebugAPIAddr
,
":6060"
,
"debug HTTP API listen address"
)
cmd
.
Flags
()
.
String
(
optionNameDebugAPIAddr
,
":6060"
,
"debug HTTP API listen address"
)
...
...
pkg/node/node.go
View file @
7c0abb35
...
@@ -74,8 +74,8 @@ type Options struct {
...
@@ -74,8 +74,8 @@ type Options struct {
DebugAPIAddr
string
DebugAPIAddr
string
Addr
string
Addr
string
NATAddr
string
NATAddr
string
DisableWS
bool
EnableWS
bool
DisableQUIC
bool
EnableQUIC
bool
NetworkID
uint64
NetworkID
uint64
WelcomeMessage
string
WelcomeMessage
string
Bootnodes
[]
string
Bootnodes
[]
string
...
@@ -156,8 +156,8 @@ func NewBee(o Options) (*Bee, error) {
...
@@ -156,8 +156,8 @@ func NewBee(o Options) (*Bee, error) {
p2ps
,
err
:=
libp2p
.
New
(
p2pCtx
,
signer
,
o
.
NetworkID
,
address
,
o
.
Addr
,
libp2p
.
Options
{
p2ps
,
err
:=
libp2p
.
New
(
p2pCtx
,
signer
,
o
.
NetworkID
,
address
,
o
.
Addr
,
libp2p
.
Options
{
PrivateKey
:
libp2pPrivateKey
,
PrivateKey
:
libp2pPrivateKey
,
NATAddr
:
o
.
NATAddr
,
NATAddr
:
o
.
NATAddr
,
DisableWS
:
o
.
Dis
ableWS
,
EnableWS
:
o
.
En
ableWS
,
DisableQUIC
:
o
.
Dis
ableQUIC
,
EnableQUIC
:
o
.
En
ableQUIC
,
Addressbook
:
addressbook
,
Addressbook
:
addressbook
,
WelcomeMessage
:
o
.
WelcomeMessage
,
WelcomeMessage
:
o
.
WelcomeMessage
,
Logger
:
logger
,
Logger
:
logger
,
...
...
pkg/p2p/libp2p/connections_test.go
View file @
7c0abb35
...
@@ -240,18 +240,18 @@ func TestDifferentNetworkIDs(t *testing.T) {
...
@@ -240,18 +240,18 @@ func TestDifferentNetworkIDs(t *testing.T) {
expectPeers
(
t
,
s2
)
expectPeers
(
t
,
s2
)
}
}
func
TestConnectWith
Dis
abledQUICAndWSTransports
(
t
*
testing
.
T
)
{
func
TestConnectWith
En
abledQUICAndWSTransports
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
defer
cancel
()
s1
,
overlay1
:=
newService
(
t
,
1
,
libp2p
.
Options
{
s1
,
overlay1
:=
newService
(
t
,
1
,
libp2p
.
Options
{
Dis
ableQUIC
:
true
,
En
ableQUIC
:
true
,
Dis
ableWS
:
true
,
En
ableWS
:
true
,
})
})
s2
,
overlay2
:=
newService
(
t
,
1
,
libp2p
.
Options
{
s2
,
overlay2
:=
newService
(
t
,
1
,
libp2p
.
Options
{
Dis
ableQUIC
:
true
,
En
ableQUIC
:
true
,
Dis
ableWS
:
true
,
En
ableWS
:
true
,
})
})
addr
:=
serviceUnderlayAddress
(
t
,
s1
)
addr
:=
serviceUnderlayAddress
(
t
,
s1
)
...
...
pkg/p2p/libp2p/libp2p.go
View file @
7c0abb35
...
@@ -62,8 +62,8 @@ type Service struct {
...
@@ -62,8 +62,8 @@ type Service struct {
type
Options
struct
{
type
Options
struct
{
PrivateKey
*
ecdsa
.
PrivateKey
PrivateKey
*
ecdsa
.
PrivateKey
NATAddr
string
NATAddr
string
DisableWS
bool
EnableWS
bool
DisableQUIC
bool
EnableQUIC
bool
LightNode
bool
LightNode
bool
WelcomeMessage
string
WelcomeMessage
string
Addressbook
addressbook
.
Putter
Addressbook
addressbook
.
Putter
...
@@ -95,20 +95,20 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
...
@@ -95,20 +95,20 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
var
listenAddrs
[]
string
var
listenAddrs
[]
string
if
ip4Addr
!=
""
{
if
ip4Addr
!=
""
{
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip4/%s/tcp/%s"
,
ip4Addr
,
port
))
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip4/%s/tcp/%s"
,
ip4Addr
,
port
))
if
!
o
.
Dis
ableWS
{
if
o
.
En
ableWS
{
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip4/%s/tcp/%s/ws"
,
ip4Addr
,
port
))
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip4/%s/tcp/%s/ws"
,
ip4Addr
,
port
))
}
}
if
!
o
.
Dis
ableQUIC
{
if
o
.
En
ableQUIC
{
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip4/%s/udp/%s/quic"
,
ip4Addr
,
port
))
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip4/%s/udp/%s/quic"
,
ip4Addr
,
port
))
}
}
}
}
if
ip6Addr
!=
""
{
if
ip6Addr
!=
""
{
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip6/%s/tcp/%s"
,
ip6Addr
,
port
))
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip6/%s/tcp/%s"
,
ip6Addr
,
port
))
if
!
o
.
Dis
ableWS
{
if
o
.
En
ableWS
{
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip6/%s/tcp/%s/ws"
,
ip6Addr
,
port
))
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip6/%s/tcp/%s/ws"
,
ip6Addr
,
port
))
}
}
if
!
o
.
Dis
ableQUIC
{
if
o
.
En
ableQUIC
{
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip6/%s/udp/%s/quic"
,
ip6Addr
,
port
))
listenAddrs
=
append
(
listenAddrs
,
fmt
.
Sprintf
(
"/ip6/%s/udp/%s/quic"
,
ip6Addr
,
port
))
}
}
}
}
...
@@ -144,11 +144,11 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
...
@@ -144,11 +144,11 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
libp2p
.
Transport
(
tcp
.
NewTCPTransport
),
libp2p
.
Transport
(
tcp
.
NewTCPTransport
),
}
}
if
!
o
.
Dis
ableWS
{
if
o
.
En
ableWS
{
transports
=
append
(
transports
,
libp2p
.
Transport
(
ws
.
New
))
transports
=
append
(
transports
,
libp2p
.
Transport
(
ws
.
New
))
}
}
if
!
o
.
Dis
ableQUIC
{
if
o
.
En
ableQUIC
{
transports
=
append
(
transports
,
libp2p
.
Transport
(
libp2pquic
.
NewTransport
))
transports
=
append
(
transports
,
libp2p
.
Transport
(
libp2pquic
.
NewTransport
))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment