mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
- Repo names: ziti-* → zt-* - Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt - Docker images: hanzozt/ziti-* → hanzozt/zt-* - C/Java/JS symbols: ziti_* → zt_* - File and directory names updated
30 lines
668 B
Go
30 lines
668 B
Go
package router
|
|
|
|
import (
|
|
"github.com/hanzozt/zt/v2/router/forwarder"
|
|
"github.com/hanzozt/zt/v2/router/xlink"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func newXlinkAccepter(f *forwarder.Forwarder) xlink.Acceptor {
|
|
return &xlinkAccepter{
|
|
forwarder: f,
|
|
}
|
|
}
|
|
|
|
func (self *xlinkAccepter) Accept(xlink xlink.Xlink) error {
|
|
if err := self.forwarder.RegisterLink(xlink); err != nil {
|
|
return err
|
|
}
|
|
logrus.WithField("linkId", xlink.Id()).
|
|
WithField("destId", xlink.DestinationId()).
|
|
WithField("iteration", xlink.Iteration()).
|
|
WithField("dialed", xlink.IsDialed()).
|
|
Info("accepted new link")
|
|
return nil
|
|
}
|
|
|
|
type xlinkAccepter struct {
|
|
forwarder *forwarder.Forwarder
|
|
}
|