|
|
|
@ -60,14 +60,9 @@ type Instance struct {
|
|
|
|
|
running bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func addInboundHandlers(server *Instance, configs []*InboundHandlerConfig) error {
|
|
|
|
|
if len(configs) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AddInboundHandler(server *Instance, config *InboundHandlerConfig) error {
|
|
|
|
|
inboundManager := server.GetFeature(inbound.ManagerType()).(inbound.Manager)
|
|
|
|
|
for _, inboundConfig := range configs {
|
|
|
|
|
rawHandler, err := CreateObject(server, inboundConfig)
|
|
|
|
|
rawHandler, err := CreateObject(server, config)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -78,19 +73,22 @@ func addInboundHandlers(server *Instance, configs []*InboundHandlerConfig) error
|
|
|
|
|
if err := inboundManager.AddHandler(context.Background(), handler); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
func addInboundHandlers(server *Instance, configs []*InboundHandlerConfig) error {
|
|
|
|
|
for _, inboundConfig := range configs {
|
|
|
|
|
if err := AddInboundHandler(server, inboundConfig); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func addOutboundHandlers(server *Instance, configs []*OutboundHandlerConfig) error {
|
|
|
|
|
if len(configs) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AddOutboundHandler(server *Instance, config *OutboundHandlerConfig) error {
|
|
|
|
|
outboundManager := server.GetFeature(outbound.ManagerType()).(outbound.Manager)
|
|
|
|
|
for _, outboundConfig := range configs {
|
|
|
|
|
rawHandler, err := CreateObject(server, outboundConfig)
|
|
|
|
|
rawHandler, err := CreateObject(server, config)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -101,6 +99,14 @@ func addOutboundHandlers(server *Instance, configs []*OutboundHandlerConfig) err
|
|
|
|
|
if err := outboundManager.AddHandler(context.Background(), handler); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func addOutboundHandlers(server *Instance, configs []*OutboundHandlerConfig) error {
|
|
|
|
|
for _, outboundConfig := range configs {
|
|
|
|
|
if err := AddOutboundHandler(server, outboundConfig); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|