Add DispatchLink

This commit is contained in:
世界 2021-09-28 09:42:57 +08:00
parent 625cf7361a
commit 50e576081e
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
5 changed files with 90 additions and 2 deletions

View file

@ -56,6 +56,15 @@ func (s *Server) Dispatch(ctx context.Context, dest net.Destination) (*transport
return &transport.Link{Reader: downlinkReader, Writer: uplinkWriter}, nil
}
// DispatchLink implements routing.Dispatcher
func (s *Server) DispatchLink(ctx context.Context, dest net.Destination, link *transport.Link) error {
if dest.Address != muxCoolAddress {
return s.dispatcher.DispatchLink(ctx, dest, link)
}
_, err := NewServerWorker(ctx, s.dispatcher, link)
return err
}
// Start implements common.Runnable.
func (s *Server) Start() error {
return nil