network

package
v1.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Network

This directory contains the network services. This defines network related commands like ping, traceroute, netstat, etc.

What is not part of network service? Commands related to protocols build on top of network layer like http, ftp, ssh, etc.

Usage

sanssh network tcp-check

Check if a TCP port is open on a remote host.

sanssh <sanssh-args> network tcp-check <host>:<port> [--timeout <timeout>]

Where:

  • <sanssh-args> common sanssh arguments
  • <host> is the host to check
  • <port> is the port to check
  • <timeout> timeout in seconds to wait for the connection to be established. Default is 3 seconds.

Useful docs

Documentation

Overview

Package healthcheck defines the RPC interface for the sansshell Network actions.

Index

Constants

View Source
const (
	Network_TCPCheck_FullMethodName = "/Network.Network/TCPCheck"
)

Variables

View Source
var (
	TCPCheckFailureReason_name = map[int32]string{
		0: "UNKNOWN",
		1: "TIMEOUT",
		2: "CONNECTION_REFUSED",
		3: "NO_SUCH_HOST",
	}
	TCPCheckFailureReason_value = map[string]int32{
		"UNKNOWN":            0,
		"TIMEOUT":            1,
		"CONNECTION_REFUSED": 2,
		"NO_SUCH_HOST":       3,
	}
)

Enum value maps for TCPCheckFailureReason.

View Source
var File_network_proto protoreflect.FileDescriptor
View Source
var Network_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Network.Network",
	HandlerType: (*NetworkServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "TCPCheck",
			Handler:    _Network_TCPCheck_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "network.proto",
}

Network_ServiceDesc is the grpc.ServiceDesc for Network service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterNetworkServer

func RegisterNetworkServer(s grpc.ServiceRegistrar, srv NetworkServer)

Types

type NetworkClient

type NetworkClient interface {
	// Check TCP Connectivity
	TCPCheck(ctx context.Context, in *TCPCheckRequest, opts ...grpc.CallOption) (*TCPCheckReply, error)
}

NetworkClient is the client API for Network service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

The Network service definition

func NewNetworkClient

func NewNetworkClient(cc grpc.ClientConnInterface) NetworkClient

type NetworkClientProxy

type NetworkClientProxy interface {
	NetworkClient
	TCPCheckOneMany(ctx context.Context, in *TCPCheckRequest, opts ...grpc.CallOption) (<-chan *TCPCheckManyResponse, error)
}

NetworkClientProxy is the superset of NetworkClient which additionally includes the OneMany proxy methods

func NewNetworkClientProxy

func NewNetworkClientProxy(cc *proxy.Conn) NetworkClientProxy

NewNetworkClientProxy creates a NetworkClientProxy for use in proxied connections. NOTE: This takes a proxy.Conn instead of a generic ClientConnInterface as the methods here are only valid in proxy.Conn contexts.

type NetworkServer

type NetworkServer interface {
	// Check TCP Connectivity
	TCPCheck(context.Context, *TCPCheckRequest) (*TCPCheckReply, error)
}

NetworkServer is the server API for Network service. All implementations should embed UnimplementedNetworkServer for forward compatibility.

The Network service definition

type TCPCheckFailureReason

type TCPCheckFailureReason int32

Enum for TCP check failure reasons

const (
	TCPCheckFailureReason_UNKNOWN            TCPCheckFailureReason = 0
	TCPCheckFailureReason_TIMEOUT            TCPCheckFailureReason = 1
	TCPCheckFailureReason_CONNECTION_REFUSED TCPCheckFailureReason = 2
	TCPCheckFailureReason_NO_SUCH_HOST       TCPCheckFailureReason = 3
)

func (TCPCheckFailureReason) Descriptor

func (TCPCheckFailureReason) Enum

func (TCPCheckFailureReason) EnumDescriptor deprecated

func (TCPCheckFailureReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use TCPCheckFailureReason.Descriptor instead.

func (TCPCheckFailureReason) Number

func (TCPCheckFailureReason) String

func (x TCPCheckFailureReason) String() string

func (TCPCheckFailureReason) Type

type TCPCheckManyResponse

type TCPCheckManyResponse struct {
	Target string
	// As targets can be duplicated this is the index into the slice passed to proxy.Conn.
	Index int
	Resp  *TCPCheckReply
	Error error
}

TCPCheckManyResponse encapsulates a proxy data packet. It includes the target, index, response and possible error returned.

type TCPCheckReply

type TCPCheckReply struct {
	Ok         bool                   `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
	FailReason *TCPCheckFailureReason `` /* 133-byte string literal not displayed */
	// contains filtered or unexported fields
}

TCPCheckReply describes the result of a rpc

func (*TCPCheckReply) Descriptor deprecated

func (*TCPCheckReply) Descriptor() ([]byte, []int)

Deprecated: Use TCPCheckReply.ProtoReflect.Descriptor instead.

func (*TCPCheckReply) GetFailReason

func (x *TCPCheckReply) GetFailReason() TCPCheckFailureReason

func (*TCPCheckReply) GetOk

func (x *TCPCheckReply) GetOk() bool

func (*TCPCheckReply) ProtoMessage

func (*TCPCheckReply) ProtoMessage()

func (*TCPCheckReply) ProtoReflect

func (x *TCPCheckReply) ProtoReflect() protoreflect.Message

func (*TCPCheckReply) Reset

func (x *TCPCheckReply) Reset()

func (*TCPCheckReply) String

func (x *TCPCheckReply) String() string

type TCPCheckRequest

type TCPCheckRequest struct {

	// The hostname to check
	Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"`
	// The port to check
	Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	// The timeout duration
	Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

TCP Check describes the request to make check of tcp connectivity check

func (*TCPCheckRequest) Descriptor deprecated

func (*TCPCheckRequest) Descriptor() ([]byte, []int)

Deprecated: Use TCPCheckRequest.ProtoReflect.Descriptor instead.

func (*TCPCheckRequest) GetHostname

func (x *TCPCheckRequest) GetHostname() string

func (*TCPCheckRequest) GetPort

func (x *TCPCheckRequest) GetPort() uint32

func (*TCPCheckRequest) GetTimeout

func (x *TCPCheckRequest) GetTimeout() *durationpb.Duration

func (*TCPCheckRequest) ProtoMessage

func (*TCPCheckRequest) ProtoMessage()

func (*TCPCheckRequest) ProtoReflect

func (x *TCPCheckRequest) ProtoReflect() protoreflect.Message

func (*TCPCheckRequest) Reset

func (x *TCPCheckRequest) Reset()

func (*TCPCheckRequest) String

func (x *TCPCheckRequest) String() string

type UnimplementedNetworkServer

type UnimplementedNetworkServer struct{}

UnimplementedNetworkServer should be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedNetworkServer) TCPCheck

type UnsafeNetworkServer

type UnsafeNetworkServer interface {
	// contains filtered or unexported methods
}

UnsafeNetworkServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NetworkServer will result in compilation errors.

Directories

Path Synopsis
Package client provides the client interface for 'network'
Package client provides the client interface for 'network'
Package server implements the sansshell 'Network' service.
Package server implements the sansshell 'Network' service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL