Documentation ¶
Overview ¶
Package util provides utility functions for the proxy package.
Index ¶
- Variables
- func GetJavaHome(ctx context.Context) (string, error)
- func GetLocalIPv4() (net.IP, error)
- func GetLocalIPv6() (net.IP, error)
- func GetNextID() int64
- func IPToDotDecimal(ip net.IP) string
- func IPv6ToUint32Array(ip net.IP) ([4]uint32, error)
- func IsDirectoryExist(path string) bool
- func IsJava(input string) bool
- func IsJavaInstalled() bool
- func PassThrough(ctx context.Context, logger *zap.Logger, clientConn net.Conn, ...) ([]byte, error)
- func ReadBuffConn(ctx context.Context, logger *zap.Logger, conn net.Conn, ...)
- func ReadBytes(ctx context.Context, logger *zap.Logger, reader io.Reader) ([]byte, error)
- func ReadFromPeer(ctx context.Context, logger *zap.Logger, conn net.Conn, buffChan chan []byte, ...) error
- func ReadInitialBuf(ctx context.Context, logger *zap.Logger, conn net.Conn) ([]byte, error)
- func ReadRequiredBytes(ctx context.Context, logger *zap.Logger, reader io.Reader, numBytes int) ([]byte, error)
- func Recover(logger *zap.Logger, client, dest net.Conn)
- func ToIP4AddressStr(ip uint32) string
- func ToIPV4(ip net.IP) (uint32, bool)
- func ToIPv6AddressStr(ip [4]uint32) string
- type Peer
Constants ¶
This section is empty.
Variables ¶
var Emoji = "\U0001F430" + " Keploy:"
Functions ¶
func GetJavaHome ¶
GetJavaHome returns the JAVA_HOME path
func GetLocalIPv4 ¶
func GetLocalIPv6 ¶
func IPToDotDecimal ¶
func IsDirectoryExist ¶
func IsJavaInstalled ¶
func IsJavaInstalled() bool
IsJavaInstalled checks if java is installed on the system
func PassThrough ¶
func PassThrough(ctx context.Context, logger *zap.Logger, clientConn net.Conn, dstCfg *integrations.ConditionalDstCfg, requestBuffer [][]byte) ([]byte, error)
PassThrough function is used to pass the network traffic to the destination connection. It also closes the destination connection if the function returns an error.
func ReadBuffConn ¶
func ReadBuffConn(ctx context.Context, logger *zap.Logger, conn net.Conn, bufferChannel chan []byte, errChannel chan error)
ReadBuffConn is used to read the buffer from the connection
func ReadBytes ¶
ReadBytes function is utilized to read the complete message from the reader until the end of the file (EOF). It returns the content as a byte array.
func ReadFromPeer ¶
func ReadFromPeer(ctx context.Context, logger *zap.Logger, conn net.Conn, buffChan chan []byte, errChan chan error, peer Peer) error
ReadFromPeer function is used to read the buffer from the peer connection. The peer can be either the client or the destination.
func ReadInitialBuf ¶
func ReadRequiredBytes ¶
func ReadRequiredBytes(ctx context.Context, logger *zap.Logger, reader io.Reader, numBytes int) ([]byte, error)
ReadRequiredBytes ReadBytes function is utilized to read the required number of bytes from the reader. It returns the content as a byte array.
func Recover ¶
Recover recovers from a panic in any parser and logs the stack trace to Sentry. It also closes the client and destination connection.
func ToIP4AddressStr ¶
ToIP4AddressStr converts the integer IP4 Address to the octet format