V2bX/core/inbound.go
yuzuki999 15c36a9580 update
refactor limiter
fix getLink bug
add connection limit
move limit config to ControllerConfig
del dynamic speed limit (next version will be re add)
del online ip sync (next version will be re add)
2023-05-16 09:15:29 +08:00

28 lines
604 B
Go

package core
import (
"context"
"fmt"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/inbound"
)
func (p *Core) RemoveInbound(tag string) error {
return p.ihm.RemoveHandler(context.Background(), tag)
}
func (p *Core) AddInbound(config *core.InboundHandlerConfig) error {
rawHandler, err := core.CreateObject(p.Server, config)
if err != nil {
return err
}
handler, ok := rawHandler.(inbound.Handler)
if !ok {
return fmt.Errorf("not an InboundHandler: %s", err)
}
if err := p.ihm.AddHandler(context.Background(), handler); err != nil {
return err
}
return nil
}