func (bsnet *impl) SendMessage( ctx context.Context, p peer.Peer, outgoing bsmsg.BitSwapMessage) error { nmsg, err := outgoing.ToNet(p) if err != nil { return err } return bsnet.service.SendMessage(ctx, nmsg) }
func (bsnet *impl) SendRequest( ctx context.Context, p peer.Peer, outgoing bsmsg.BitSwapMessage) (bsmsg.BitSwapMessage, error) { outgoingMsg, err := outgoing.ToNet(p) if err != nil { return nil, err } incomingMsg, err := bsnet.service.SendRequest(ctx, outgoingMsg) if err != nil { return nil, err } return bsmsg.FromNet(incomingMsg) }