func CreateInboundHandler(ctx context.Context, config interface{}) (Inbound, error) { handler, err := common.CreateObject(ctx, config) if err != nil { return nil, err } switch h := handler.(type) { case Inbound: return h, nil default: return nil, errors.New("Proxy: Not a InboundHandler.") } }
func CreateAppFromConfig(ctx context.Context, config interface{}) (Application, error) { application, err := common.CreateObject(ctx, config) if err != nil { return nil, err } switch a := application.(type) { case Application: return a, nil default: return nil, errors.New("App: Not an application.") } }
func CreatePacketHeader(config interface{}) (PacketHeader, error) { header, err := common.CreateObject(context.Background(), config) if err != nil { return nil, err } switch h := header.(type) { case PacketHeader: return h, nil default: return nil, errors.New("Internet: Not a packet header.") } }
func CreateConnectionAuthenticator(config interface{}) (ConnectionAuthenticator, error) { auth, err := common.CreateObject(context.Background(), config) if err != nil { return nil, err } switch a := auth.(type) { case ConnectionAuthenticator: return a, nil default: return nil, errors.New("Internet: Not a ConnectionAuthenticator.") } }