Documentation
¶
Index ¶
- func AddrCompletion(raw string, ip net.IP, port uint16) string
- func MaxProcessNameLength() int
- func RenameMyProcess(ctx context.Context, name string)
- func ResolveTCPAddr(raw string, ip net.IP, port uint16) (*net.TCPAddr, error)
- func ResolveUDPAddr(raw string, ip net.IP, port uint16) (*net.UDPAddr, error)
- func SimpleContext() context.Context
- func WritePID(ctx context.Context, file string, pid int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddrCompletion ¶
AddrCompletion convert given raw string to standardized address, if the ip/port part of raw missing, will use ip and port to complete it. if the given ip is nil, treat as 0.0.0.0 "" => ip:port 80 => ip:80 1.1.1.1 => 1.1.1.1:port
func MaxProcessNameLength ¶
func MaxProcessNameLength() int
MaxProcessNameLength returns sum of all string length of elements in os.Args
func RenameMyProcess ¶
RenameMyProcess overwrite all args in os.Args, the maxium length of new name is equal to length sum of all os.Args. Because of space split between args, the real display mostly like this: e.g. this is a demo. =display=> this i s a demo. You could define a customied encode/decode rules to avoid the problem: e.g. this is a demo. =encode=> this+is+a+demo. =display=> this+i s+a+ demo.
func ResolveTCPAddr ¶
ResolveTCPAddr use AddrCompletion to resolve the raw as a tcp address
func ResolveUDPAddr ¶
ResolveUDPAddr use AddrCompletion to resolve the raw as a udp address
func SimpleContext ¶
Types ¶
This section is empty.