(ctx context.Context)
| 145 | } |
| 146 | |
| 147 | func (c *client) sendID(ctx context.Context) (errc chan error) { |
| 148 | errc = make(chan error) |
| 149 | go func() { |
| 150 | defer close(errc) |
| 151 | |
| 152 | var err error |
| 153 | var bytes, pubKeyBytes []byte |
| 154 | if pubKeyBytes, err = c.localPubKey.MarshalBinary(); err != nil { |
| 155 | utils.ReportError(ctx, errc, errors.Errorf("MarshalBinary: %w", err)) |
| 156 | return |
| 157 | } |
| 158 | |
| 159 | pID := &ID{ |
| 160 | PublicKey: pubKeyBytes, |
| 161 | Id: c.localID, |
| 162 | } |
| 163 | |
| 164 | if bytes, err = encodeProto(pID, c.localID, nil, 0, false); err != nil { |
| 165 | utils.ReportError(ctx, errc, errors.Errorf("encodeProto: %w", err)) |
| 166 | } |
| 167 | |
| 168 | if err = writeTo(bytes, c.conn); err != nil { |
| 169 | utils.ReportError(ctx, errc, errors.Errorf("writeTo: %w", err)) |
| 170 | } |
| 171 | return |
| 172 | }() |
| 173 | return |
| 174 | } |
| 175 | |
| 176 | func (c *client) run() (err error) { |
| 177 | c.sendPipe(c.encryptPipe(c.packPipe(c.dispatch(c.decodePipe(c.decryptPipe(c.readPipe())))))) |
no test coverage detected