Add PipeCreateErrorCallback to handle pipe creation errors (#290)
* Add PipeCreateErrorCallback to handle pipe creation errors * Add test for FailtobanPipeCreateFail * Fix missing newline at end of file in pluginbase.go
This commit is contained in:
parent
295262fe68
commit
9fee039d93
9 changed files with 499 additions and 117 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.20.1
|
||||
// - protoc v4.25.1
|
||||
// source: plugin.proto
|
||||
|
||||
package libplugin
|
||||
|
|
@ -33,6 +33,7 @@ type SshPiperPluginClient interface {
|
|||
UpstreamAuthFailureNotice(ctx context.Context, in *UpstreamAuthFailureNoticeRequest, opts ...grpc.CallOption) (*UpstreamAuthFailureNoticeResponse, error)
|
||||
Banner(ctx context.Context, in *BannerRequest, opts ...grpc.CallOption) (*BannerResponse, error)
|
||||
VerifyHostKey(ctx context.Context, in *VerifyHostKeyRequest, opts ...grpc.CallOption) (*VerifyHostKeyResponse, error)
|
||||
PipeCreateErrorNotice(ctx context.Context, in *PipeCreateErrorNoticeRequest, opts ...grpc.CallOption) (*PipeCreateErrorNoticeResponse, error)
|
||||
PipeStartNotice(ctx context.Context, in *PipeStartNoticeRequest, opts ...grpc.CallOption) (*PipeStartNoticeResponse, error)
|
||||
PipeErrorNotice(ctx context.Context, in *PipeErrorNoticeRequest, opts ...grpc.CallOption) (*PipeErrorNoticeResponse, error)
|
||||
}
|
||||
|
|
@ -189,6 +190,15 @@ func (c *sshPiperPluginClient) VerifyHostKey(ctx context.Context, in *VerifyHost
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *sshPiperPluginClient) PipeCreateErrorNotice(ctx context.Context, in *PipeCreateErrorNoticeRequest, opts ...grpc.CallOption) (*PipeCreateErrorNoticeResponse, error) {
|
||||
out := new(PipeCreateErrorNoticeResponse)
|
||||
err := c.cc.Invoke(ctx, "/libplugin.SshPiperPlugin/PipeCreateErrorNotice", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *sshPiperPluginClient) PipeStartNotice(ctx context.Context, in *PipeStartNoticeRequest, opts ...grpc.CallOption) (*PipeStartNoticeResponse, error) {
|
||||
out := new(PipeStartNoticeResponse)
|
||||
err := c.cc.Invoke(ctx, "/libplugin.SshPiperPlugin/PipeStartNotice", in, out, opts...)
|
||||
|
|
@ -222,6 +232,7 @@ type SshPiperPluginServer interface {
|
|||
UpstreamAuthFailureNotice(context.Context, *UpstreamAuthFailureNoticeRequest) (*UpstreamAuthFailureNoticeResponse, error)
|
||||
Banner(context.Context, *BannerRequest) (*BannerResponse, error)
|
||||
VerifyHostKey(context.Context, *VerifyHostKeyRequest) (*VerifyHostKeyResponse, error)
|
||||
PipeCreateErrorNotice(context.Context, *PipeCreateErrorNoticeRequest) (*PipeCreateErrorNoticeResponse, error)
|
||||
PipeStartNotice(context.Context, *PipeStartNoticeRequest) (*PipeStartNoticeResponse, error)
|
||||
PipeErrorNotice(context.Context, *PipeErrorNoticeRequest) (*PipeErrorNoticeResponse, error)
|
||||
mustEmbedUnimplementedSshPiperPluginServer()
|
||||
|
|
@ -264,6 +275,9 @@ func (UnimplementedSshPiperPluginServer) Banner(context.Context, *BannerRequest)
|
|||
func (UnimplementedSshPiperPluginServer) VerifyHostKey(context.Context, *VerifyHostKeyRequest) (*VerifyHostKeyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method VerifyHostKey not implemented")
|
||||
}
|
||||
func (UnimplementedSshPiperPluginServer) PipeCreateErrorNotice(context.Context, *PipeCreateErrorNoticeRequest) (*PipeCreateErrorNoticeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PipeCreateErrorNotice not implemented")
|
||||
}
|
||||
func (UnimplementedSshPiperPluginServer) PipeStartNotice(context.Context, *PipeStartNoticeRequest) (*PipeStartNoticeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PipeStartNotice not implemented")
|
||||
}
|
||||
|
|
@ -492,6 +506,24 @@ func _SshPiperPlugin_VerifyHostKey_Handler(srv interface{}, ctx context.Context,
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SshPiperPlugin_PipeCreateErrorNotice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PipeCreateErrorNoticeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SshPiperPluginServer).PipeCreateErrorNotice(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/libplugin.SshPiperPlugin/PipeCreateErrorNotice",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SshPiperPluginServer).PipeCreateErrorNotice(ctx, req.(*PipeCreateErrorNoticeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SshPiperPlugin_PipeStartNotice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PipeStartNoticeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
|
@ -571,6 +603,10 @@ var SshPiperPlugin_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "VerifyHostKey",
|
||||
Handler: _SshPiperPlugin_VerifyHostKey_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PipeCreateErrorNotice",
|
||||
Handler: _SshPiperPlugin_PipeCreateErrorNotice_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PipeStartNotice",
|
||||
Handler: _SshPiperPlugin_PipeStartNotice_Handler,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue