⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@ checks:
postage-depth: 21
postage-label: test-label
type: feed

autotls:
timeout: 5m
type: autotls
# simulations defines simulations Beekeeper can execute against the cluster
# type filed allows defining same simulation with different names and options
simulations:
Expand Down
44 changes: 43 additions & 1 deletion config/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ clusters:
config: local
count: 2
mode: node
wss:
bee-config: bee-local-wss
config: local
count: 2
mode: node
ultralight:
bee-config: bee-local-ultralight
config: local-ultralight
count: 1
mode: node
local-dns:
_inherit: "local"
node-groups:
Expand All @@ -42,11 +52,21 @@ clusters:
config: local-dns
count: 3
mode: node
wss:
bee-config: bee-local-wss
config: local-dns
count: 2
mode: node
light:
bee-config: bee-local-light
config: local-light
count: 2
mode: node
ultralight:
bee-config: bee-local-ultralight
config: local-ultralight
count: 2
mode: node
local-gc:
_inherit: "local"
node-groups:
Expand Down Expand Up @@ -104,6 +124,14 @@ node-groups:
_inherit: "local"
local-light:
_inherit: "local"
local-ultralight:
_inherit: "local"
labels:
app.kubernetes.io/component: "node"
app.kubernetes.io/name: "bee"
app.kubernetes.io/part-of: "bee"
app.kubernetes.io/version: "latest"
beekeeper.ethswarm.org/node-funder: "false"

# bee-configs defines Bee configuration that can be assigned to node-groups
bee-configs:
Expand Down Expand Up @@ -134,7 +162,7 @@ bee-configs:
p2p-addr: ":1634"
p2p-wss-addr: ":1635"
p2p-ws-enable: false
p2p-wss-enable: true
p2p-wss-enable: false
password: "beekeeper"
payment-early-percent: 50
payment-threshold: 13500000
Expand All @@ -157,6 +185,9 @@ bee-configs:
bootnode-local:
_inherit: "bee-local"
bootnode-mode: true
bee-local-wss:
_inherit: "bee-local"
p2p-wss-enable: true
bee-local-dns:
_inherit: "bee-local"
bootnode: /dnsaddr/localhost
Expand All @@ -171,6 +202,11 @@ bee-configs:
bee-local-gc:
_inherit: "bee-local"
cache-capacity: 10
bee-local-ultralight:
_inherit: "bee-local"
blockchain-rpc-endpoint: ""
full-node: false
swap-enable: false
bootnode-local-gc:
_inherit: "bee-local"
cache-capacity: 10
Expand Down Expand Up @@ -398,3 +434,9 @@ checks:
postage-depth: 21
postage-label: test-label
type: feed
ci-autotls:
timeout: 15m
type: autotls
options:
ultralight-group: ultralight
wss-group: wss
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/go-git/go-git/v5 v5.13.2
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/multiformats/go-multiaddr v0.12.3
github.com/opentracing/opentracing-go v1.2.0
github.com/prometheus/client_golang v1.21.1
github.com/prometheus/common v0.62.0
Expand Down Expand Up @@ -94,7 +95,6 @@ require (
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.12.3 // indirect
github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
Expand Down
18 changes: 18 additions & 0 deletions pkg/bee/api/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ func (n *NodeService) Peers(ctx context.Context) (resp Peers, err error) {
return resp, err
}

// ConnectResponse represents the response from the connect endpoint
type ConnectResponse struct {
Address string `json:"address"`
}

// Connect connects to a peer using the provided multiaddress.
// The multiaddr should be in the format: /ip4/x.x.x.x/tcp/port/...
// Returns the overlay address of the connected peer.
func (n *NodeService) Connect(ctx context.Context, multiaddr string) (resp ConnectResponse, err error) {
err = n.client.requestJSON(ctx, http.MethodPost, "/connect"+multiaddr, nil, &resp)
return resp, err
}

// Disconnect disconnects from a peer with the given overlay address.
func (n *NodeService) Disconnect(ctx context.Context, overlay swarm.Address) error {
return n.client.requestJSON(ctx, http.MethodDelete, "/peers/"+overlay.String(), nil, nil)
}

// Readiness represents node's readiness
type Readiness struct {
Status string `json:"status"`
Expand Down
24 changes: 24 additions & 0 deletions pkg/bee/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,30 @@ func (c *Client) Peers(ctx context.Context) (peers []swarm.Address, err error) {
return peers, err
}

// Connect connects to a peer using the provided multiaddress.
// Returns the overlay address of the connected peer.
func (c *Client) Connect(ctx context.Context, multiaddr string) (swarm.Address, error) {
resp, err := c.api.Node.Connect(ctx, multiaddr)
if err != nil {
return swarm.ZeroAddress, fmt.Errorf("connect to %s: %w", multiaddr, err)
}

addr, err := swarm.ParseHexAddress(resp.Address)
if err != nil {
return swarm.ZeroAddress, fmt.Errorf("parse overlay address %s: %w", resp.Address, err)
}

return addr, nil
}

// Disconnect disconnects from a peer with the given overlay address.
func (c *Client) Disconnect(ctx context.Context, overlay swarm.Address) error {
if err := c.api.Node.Disconnect(ctx, overlay); err != nil {
return fmt.Errorf("disconnect from %s: %w", overlay, err)
}
return nil
}

// PinRootHash pins root hash of given reference.
func (c *Client) PinRootHash(ctx context.Context, ref swarm.Address) error {
return c.api.Pinning.PinRootHash(ctx, ref)
Expand Down
Loading