| 108 | } |
| 109 | |
| 110 | func (s *ClientService) ServeClient(ctx context.Context, version string, conn net.Conn, streamID StreamID) error { |
| 111 | major, _, err := apiversion.Parse(version) |
| 112 | if err != nil { |
| 113 | s.Logger.Warn(ctx, "serve client called with unparsable version", slog.Error(err)) |
| 114 | return err |
| 115 | } |
| 116 | switch major { |
| 117 | case 2: |
| 118 | return s.ServeConnV2(ctx, conn, streamID) |
| 119 | default: |
| 120 | s.Logger.Warn(ctx, "serve client called with unsupported version", slog.F("version", version)) |
| 121 | return ErrUnsupportedVersion |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func (s ClientService) ServeConnV2(ctx context.Context, conn net.Conn, streamID StreamID) error { |
| 126 | config := yamux.DefaultConfig() |