router: router.id is optional
This commit is contained in:
+14
-18
@@ -37,16 +37,17 @@ func init() {
|
||||
}
|
||||
|
||||
type routerHandler struct {
|
||||
id string
|
||||
options handler.Options
|
||||
pool *ConnectorPool
|
||||
epConn net.PacketConn
|
||||
md metadata
|
||||
log logger.Logger
|
||||
stats *stats_util.HandlerStats
|
||||
limiter traffic.TrafficLimiter
|
||||
cancel context.CancelFunc
|
||||
sdCache *cache.Cache
|
||||
id string
|
||||
options handler.Options
|
||||
pool *ConnectorPool
|
||||
epConn net.PacketConn
|
||||
md metadata
|
||||
log logger.Logger
|
||||
stats *stats_util.HandlerStats
|
||||
limiter traffic.TrafficLimiter
|
||||
cancel context.CancelFunc
|
||||
sdCache *cache.Cache
|
||||
routeCache *cache.Cache
|
||||
}
|
||||
|
||||
func NewHandler(opts ...handler.Option) handler.Handler {
|
||||
@@ -56,8 +57,9 @@ func NewHandler(opts ...handler.Option) handler.Handler {
|
||||
}
|
||||
|
||||
return &routerHandler{
|
||||
options: options,
|
||||
sdCache: cache.NewCache(time.Minute),
|
||||
options: options,
|
||||
sdCache: cache.NewCache(time.Minute),
|
||||
routeCache: cache.NewCache(time.Minute),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,12 +205,6 @@ func (h *routerHandler) Handle(ctx context.Context, conn net.Conn, opts ...handl
|
||||
}
|
||||
}
|
||||
|
||||
if routerID.IsZero() {
|
||||
resp.Status = relay.StatusBadRequest
|
||||
resp.WriteTo(conn)
|
||||
return ErrRouterID
|
||||
}
|
||||
|
||||
if user != "" {
|
||||
log = log.WithFields(map[string]any{"user": user})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user