osutil

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package osutil document

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(dstFile, srcFile string) (err error)

Copy src file content to dstFile, overwrite dstFile if exist, dstFile can be directory.

func ReadAllLines

func ReadAllLines(fn string) ([]string, error)

ReadAllLines read a text file to a string array, each item is a line.

func SetIpv4TCPKeepAliveParameters

func SetIpv4TCPKeepAliveParameters(idle, intvl, probes int)

SetIpv4TCPKeepAliveParameters set OS tcp keep alive parameters. idle: How many seconds to seed keep alive package after last send data intvl: If not receive keep alive package response, wait how many seconds to send another one (prob). probes: How many probs tried and not receive response, tcp think the link has gone. If failed, call os.Exit(-3) Currently only support linux.

func SetMaxOpenFiles

func SetMaxOpenFiles(n uint64)

SetMaxOpenFiles set process ulimit of max opened files to max online endpoints + 50, if set failed, call os.Exit(-2).

func WriteFile

func WriteFile(filename string, data []byte, dirPerm, filePerm os.FileMode) error

WriteFile write data to a file named filename, exist content will truncate. If directory and/or file not exist, create using dirPerm and filePerm.

Types

This section is empty.

Jump to

Keyboard shortcuts

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