cmux
Setup
| Command | Use |
|---|---|
| l, _ := net.Listen("tcp", ":23456") m := cmux.New(l) | Wrap the listener with cmux |
Matching
| Command | Use |
|---|---|
| grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc")) httpL := m.Match(cmux.HTTP1Fast()) anyL := m.Match(cmux.Any()) | Match listeners in order |
Serving
| Command | Use |
|---|---|
| go grpcS.Serve(grpcL) go httpS.Serve(httpL) go rpcS.Accept(anyL) m.Serve() | Serve protocols from matched listeners |