parseWire decodes cb into its wire form, without restoring the fields that [ConnInfo.ConnBlob] elides.
(cb ConnBlob)
| 717 | // parseWire decodes cb into its wire form, without restoring the |
| 718 | // fields that [ConnInfo.ConnBlob] elides. |
| 719 | func parseWire(cb ConnBlob) (*wireConnInfo, error) { |
| 720 | rest, ok := strings.CutPrefix(string(cb), "tc") |
| 721 | if !ok { |
| 722 | return nil, errors.New("server address doesn't start with \"tc\"") |
| 723 | } |
| 724 | x, err := base64.RawURLEncoding.DecodeString(rest) |
| 725 | if err != nil { |
| 726 | return nil, fmt.Errorf("base64 decode: %w", err) |
| 727 | } |
| 728 | w := new(wireConnInfo) |
| 729 | if err := cbor.Unmarshal(x, w); err != nil { |
| 730 | return nil, fmt.Errorf("CBOR unmarshal: %v", err) |
| 731 | } |
| 732 | return w, nil |
| 733 | } |
| 734 | |
| 735 | // ParseConnBlobRaw decodes cb into its wire form, without restoring |
| 736 | // the implicit fields that [ParseConnBlob] synthesizes (region and |
no outgoing calls
no test coverage detected