soheilhy / cmux

Connection multiplexer for GoLang: serve different services on the same port!
Apache License 2.0
2.53k stars 197 forks source link

It's hard to extend protocol #79

Open drunkpig opened 3 years ago

drunkpig commented 3 years ago

some protocols are private and strange, so I'd like provide a method to write customer defined protocol Matcher.

drunkpig commented 3 years ago

besids this , cmux use first N bytes to seperate protocol, N is various。 When cmux match protocol in the order of http(use first 8 bytes) then socks5(use first byte) , the socks handler will never reached! The reason is Matcher is blocked at http Matcher, it will never read all first 8 bytes.

Jille commented 2 years ago

(I have little experience with cmux, but) can't you just create your own matcher by defining a func(io.Reader) bool and using that?

munding commented 1 year ago

maybe you need to Match connections in order, first socks then http