don't allow making tunnels to initiator

This commit is contained in:
Henry 2021-05-10 08:01:09 +02:00
parent e72f1a3787
commit 2ecf61f123
1 changed files with 5 additions and 1 deletions

View File

@ -71,8 +71,12 @@ func (h connectHandler) HandleDuplex(ctx context.Context, req *muxrpc.Request, p
return err
}
// see if we have and endpoint for the target
// make sure they dont want to connect to themselves
if caller.Equal(&arg.Target) {
return fmt.Errorf("can't connect to self")
}
// see if we have and endpoint for the target
edp, has := h.state.Has(arg.Target)
if !has {
return fmt.Errorf("could not connect to:%s", arg.Target.Ref())