Skip to content

Commit

Permalink
refactor: remove unused StreamOpts
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <[email protected]>
  • Loading branch information
paralin committed Jun 21, 2024
1 parent 7702f04 commit 0a1904d
Show file tree
Hide file tree
Showing 29 changed files with 63 additions and 376 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- **Flexible**: use multiple transports, protocols, simultaneously.
- **Meshing**: supports multi-hop routing to a desired target peer w/ circuits.
- **PubSub**: publish/subscribe channels with pluggable implementations.
- **Robust**: uses Quic for reliable connections over lossy transports.
- **Robust**: uses Quic for lossless links over lossy transports.

Bifrost uses [ControllerBus] controllers and directives to send any protocol
over any transport with extensive and flexible configuration.
Expand Down
24 changes: 0 additions & 24 deletions cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,6 @@ func (a *ClientArgs) BuildCommands() []*cli.Command {
Usage: "if set, filter the transport id",
Destination: &a.DialConf.TransportId,
},
&cli.BoolFlag{
Name: "encrypted",
Usage: "encrypted stream",
Destination: &a.DialConf.Encrypted,
Value: true,
},
&cli.BoolFlag{
Name: "reliable",
Usage: "reliable stream",
Destination: &a.DialConf.Reliable,
Value: true,
},
},
},
{
Expand Down Expand Up @@ -283,18 +271,6 @@ func (a *ClientArgs) BuildCommands() []*cli.Command {
Usage: "listen multiaddr",
Destination: &a.ListeningConf.ListenMultiaddr,
},
&cli.BoolFlag{
Name: "encrypted",
Usage: "encrypted stream",
Destination: &a.ListeningConf.Encrypted,
Value: true,
},
&cli.BoolFlag{
Name: "reliable",
Usage: "reliable stream",
Destination: &a.ListeningConf.Reliable,
Value: true,
},
},
},
}
Expand Down
2 changes: 0 additions & 2 deletions examples/http-forwarding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ listening:
remotePeerId: 12D3KooWC9dBAEoTHbEXq2aaTeFit7QVdvPcb6Yf76oGQZ6dGf8N
protocolId: my/http/forwarding
listenMultiaddr: "/ip4/127.0.0.1/tcp/8084"
reliable: true
encrypted: true
```

### Changing the transport
Expand Down
2 changes: 0 additions & 2 deletions examples/http-forwarding/node-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ listening:
remotePeerId: 12D3KooWC9dBAEoTHbEXq2aaTeFit7QVdvPcb6Yf76oGQZ6dGf8N
protocolId: my/http/forwarding
listenMultiaddr: "/ip4/127.0.0.1/tcp/8084"
reliable: true
encrypted: true

2 changes: 0 additions & 2 deletions examples/webrtc-forwarding/node-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ listening:
remotePeerId: 12D3KooWC9dBAEoTHbEXq2aaTeFit7QVdvPcb6Yf76oGQZ6dGf8N
protocolId: my/http/forwarding
listenMultiaddr: "/ip4/127.0.0.1/tcp/8084"
reliable: true
encrypted: true

signaling-websocket:
id: bifrost/websocket
Expand Down
2 changes: 1 addition & 1 deletion pubsub/controller/tracked-link.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (t *trackedLink) trackLink(ctx context.Context) error {
link.NewOpenStreamViaLink(
t.lnk.GetUUID(),
t.c.protocolID,
stream.OpenOpts{Reliable: true, Encrypted: true},
stream.OpenOpts{},
t.lnk.GetTransportUUID(),
),
nil,
Expand Down
5 changes: 0 additions & 5 deletions pubsub/floodsub/floodsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,6 @@ func (m *FloodSub) AddPeerStream(
mstrm link.MountedStream,
) {
le := m.le.WithField("peer", tpl.PeerID.String())
if !mstrm.GetOpenOpts().Encrypted || !mstrm.GetOpenOpts().Reliable {
le.Warn("rejecting unencrypted or unreliable pubsub stream")
mstrm.GetStream().Close()
return
}
sh := &streamHandler{
m: m,
le: le,
Expand Down
5 changes: 0 additions & 5 deletions pubsub/nats/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ func (m *Nats) Execute(ctx context.Context) error {
// The pubsub should communicate over the stream.
func (m *Nats) AddPeerStream(tpl pubsub.PeerLinkTuple, initiator bool, mstrm link.MountedStream) {
le := m.le.WithField("peer", tpl.PeerID.String())
if !mstrm.GetOpenOpts().Encrypted || !mstrm.GetOpenOpts().Reliable {
le.Warn("rejecting unencrypted or unreliable pubsub stream")
mstrm.GetStream().Close()
return
}
protocolID := mstrm.GetProtocolID()
streamType := ProtocolIDToStreamType(protocolID)
if streamType == NatsConnType_NatsConnType_UNKNOWN {
Expand Down
2 changes: 1 addition & 1 deletion sim/simulate/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestConnectivity(ctx context.Context, px0, px1 *Peer) error {
px0.GetPeerID(),
px1.GetPeerID(),
0,
stream.OpenOpts{Reliable: true, Encrypted: true},
stream.OpenOpts{},
),
nil,
nil,
Expand Down
5 changes: 1 addition & 4 deletions stream/api/dial/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ func ProcessRPC(
protocol.ID(conf.GetProtocolId()),
localPeerID, remotePeerID,
conf.GetTransportId(),
stream.OpenOpts{
Reliable: conf.GetReliable(),
Encrypted: conf.GetEncrypted(),
},
stream.OpenOpts{},
)
if err != nil {
return err
Expand Down
116 changes: 0 additions & 116 deletions stream/api/dial/dial.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions stream/api/dial/dial.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ export interface Config {
* @generated from field: uint64 transport_id = 4;
*/
transportId?: bigint
/**
* Encrypted indicates the stream should be encrypted.
*
* @generated from field: bool encrypted = 5;
*/
encrypted?: boolean
/**
* Reliable indicates the stream should be reliable.
*
* @generated from field: bool reliable = 6;
*/
reliable?: boolean
}

// Config contains the message type declaration for Config.
Expand All @@ -61,8 +49,6 @@ export const Config: MessageType<Config> = createMessageType({
{ no: 2, name: 'local_peer_id', kind: 'scalar', T: ScalarType.STRING },
{ no: 3, name: 'protocol_id', kind: 'scalar', T: ScalarType.STRING },
{ no: 4, name: 'transport_id', kind: 'scalar', T: ScalarType.UINT64 },
{ no: 5, name: 'encrypted', kind: 'scalar', T: ScalarType.BOOL },
{ no: 6, name: 'reliable', kind: 'scalar', T: ScalarType.BOOL },
] as readonly PartialFieldInfo[],
packedByDefault: true,
})
6 changes: 1 addition & 5 deletions stream/api/dial/dial.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ message Config {
// TransportId constrains the transport ID to dial with.
// Can be empty.
uint64 transport_id = 4;
// Encrypted indicates the stream should be encrypted.
bool encrypted = 5;
// Reliable indicates the stream should be reliable.
bool reliable = 6;
}
}
5 changes: 1 addition & 4 deletions stream/listening/listening.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ func (c *Controller) handleConn(ctx context.Context, conn manet.Conn) {
openCtx, openCtxCancel := context.WithTimeout(ctx, openStreamTimeout)
defer openCtxCancel()

opts := stream.OpenOpts{
Reliable: c.conf.GetReliable(),
Encrypted: c.conf.GetEncrypted(),
}
opts := stream.OpenOpts{}
mstrm, rel, err := link.OpenStreamWithPeerEx(
openCtx,
c.bus,
Expand Down
Loading

0 comments on commit 0a1904d

Please sign in to comment.