mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
15c36a9580
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)
28 lines
604 B
Go
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
|
|
}
|