$53 GRAYBYTE WORDPRESS FILE MANAGER $94

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/lib/golang/src/net/

HOME
Current File : /lib/golang/src/net//parse.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Simple file i/o and string manipulation, to avoid
// depending on strconv and bufio and strings.

package net

import (
	"internal/bytealg"
	"io"
	"os"
	"time"
)

type file struct {
	file  *os.File
	data  []byte
	atEOF bool
}

func (f *file) close() { f.file.Close() }

func (f *file) getLineFromData() (s string, ok bool) {
	data := f.data
	i := 0
	for i = 0; i < len(data); i++ {
		if data[i] == '\n' {
			s = string(data[0:i])
			ok = true
			// move data
			i++
			n := len(data) - i
			copy(data[0:], data[i:])
			f.data = data[0:n]
			return
		}
	}
	if f.atEOF && len(f.data) > 0 {
		// EOF, return all we have
		s = string(data)
		f.data = f.data[0:0]
		ok = true
	}
	return
}

func (f *file) readLine() (s string, ok bool) {
	if s, ok = f.getLineFromData(); ok {
		return
	}
	if len(f.data) < cap(f.data) {
		ln := len(f.data)
		n, err := io.ReadFull(f.file, f.data[ln:cap(f.data)])
		if n >= 0 {
			f.data = f.data[0 : ln+n]
		}
		if err == io.EOF || err == io.ErrUnexpectedEOF {
			f.atEOF = true
		}
	}
	s, ok = f.getLineFromData()
	return
}

func (f *file) stat() (mtime time.Time, size int64, err error) {
	st, err := f.file.Stat()
	if err != nil {
		return time.Time{}, 0, err
	}
	return st.ModTime(), st.Size(), nil
}

func open(name string) (*file, error) {
	fd, err := os.Open(name)
	if err != nil {
		return nil, err
	}
	return &file{fd, make([]byte, 0, 64*1024), false}, nil
}

func stat(name string) (mtime time.Time, size int64, err error) {
	st, err := os.Stat(name)
	if err != nil {
		return time.Time{}, 0, err
	}
	return st.ModTime(), st.Size(), nil
}

// Count occurrences in s of any bytes in t.
func countAnyByte(s string, t string) int {
	n := 0
	for i := 0; i < len(s); i++ {
		if bytealg.IndexByteString(t, s[i]) >= 0 {
			n++
		}
	}
	return n
}

// Split s at any bytes in t.
func splitAtBytes(s string, t string) []string {
	a := make([]string, 1+countAnyByte(s, t))
	n := 0
	last := 0
	for i := 0; i < len(s); i++ {
		if bytealg.IndexByteString(t, s[i]) >= 0 {
			if last < i {
				a[n] = s[last:i]
				n++
			}
			last = i + 1
		}
	}
	if last < len(s) {
		a[n] = s[last:]
		n++
	}
	return a[0:n]
}

func getFields(s string) []string { return splitAtBytes(s, " \r\t\n") }

// Bigger than we need, not too big to worry about overflow
const big = 0xFFFFFF

// Decimal to integer.
// Returns number, characters consumed, success.
func dtoi(s string) (n int, i int, ok bool) {
	n = 0
	for i = 0; i < len(s) && '0' <= s[i] && s[i] <= '9'; i++ {
		n = n*10 + int(s[i]-'0')
		if n >= big {
			return big, i, false
		}
	}
	if i == 0 {
		return 0, 0, false
	}
	return n, i, true
}

// Hexadecimal to integer.
// Returns number, characters consumed, success.
func xtoi(s string) (n int, i int, ok bool) {
	n = 0
	for i = 0; i < len(s); i++ {
		if '0' <= s[i] && s[i] <= '9' {
			n *= 16
			n += int(s[i] - '0')
		} else if 'a' <= s[i] && s[i] <= 'f' {
			n *= 16
			n += int(s[i]-'a') + 10
		} else if 'A' <= s[i] && s[i] <= 'F' {
			n *= 16
			n += int(s[i]-'A') + 10
		} else {
			break
		}
		if n >= big {
			return 0, i, false
		}
	}
	if i == 0 {
		return 0, i, false
	}
	return n, i, true
}

// xtoi2 converts the next two hex digits of s into a byte.
// If s is longer than 2 bytes then the third byte must be e.
// If the first two bytes of s are not hex digits or the third byte
// does not match e, false is returned.
func xtoi2(s string, e byte) (byte, bool) {
	if len(s) > 2 && s[2] != e {
		return 0, false
	}
	n, ei, ok := xtoi(s[:2])
	return byte(n), ok && ei == 2
}

// hasUpperCase tells whether the given string contains at least one upper-case.
func hasUpperCase(s string) bool {
	for i := range s {
		if 'A' <= s[i] && s[i] <= 'Z' {
			return true
		}
	}
	return false
}

// lowerASCIIBytes makes x ASCII lowercase in-place.
func lowerASCIIBytes(x []byte) {
	for i, b := range x {
		if 'A' <= b && b <= 'Z' {
			x[i] += 'a' - 'A'
		}
	}
}

// lowerASCII returns the ASCII lowercase version of b.
func lowerASCII(b byte) byte {
	if 'A' <= b && b <= 'Z' {
		return b + ('a' - 'A')
	}
	return b
}

// trimSpace returns x without any leading or trailing ASCII whitespace.
func trimSpace(x string) string {
	for len(x) > 0 && isSpace(x[0]) {
		x = x[1:]
	}
	for len(x) > 0 && isSpace(x[len(x)-1]) {
		x = x[:len(x)-1]
	}
	return x
}

// isSpace reports whether b is an ASCII space character.
func isSpace(b byte) bool {
	return b == ' ' || b == '\t' || b == '\n' || b == '\r'
}

// removeComment returns line, removing any '#' byte and any following
// bytes.
func removeComment(line string) string {
	if i := bytealg.IndexByteString(line, '#'); i != -1 {
		return line[:i]
	}
	return line
}

// foreachField runs fn on each non-empty run of non-space bytes in x.
// It returns the first non-nil error returned by fn.
func foreachField(x string, fn func(field string) error) error {
	x = trimSpace(x)
	for len(x) > 0 {
		sp := bytealg.IndexByteString(x, ' ')
		if sp == -1 {
			return fn(x)
		}
		if field := trimSpace(x[:sp]); len(field) > 0 {
			if err := fn(field); err != nil {
				return err
			}
		}
		x = trimSpace(x[sp+1:])
	}
	return nil
}

// stringsHasSuffixFold reports whether s ends in suffix,
// ASCII-case-insensitively.
func stringsHasSuffixFold(s, suffix string) bool {
	return len(s) >= len(suffix) && stringsEqualFold(s[len(s)-len(suffix):], suffix)
}

// stringsEqualFold is strings.EqualFold, ASCII only. It reports whether s and t
// are equal, ASCII-case-insensitively.
func stringsEqualFold(s, t string) bool {
	if len(s) != len(t) {
		return false
	}
	for i := 0; i < len(s); i++ {
		if lowerASCII(s[i]) != lowerASCII(t[i]) {
			return false
		}
	}
	return true
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.30 PM
root / root
0755
http
--
16 Dec 2025 9.30 PM
root / root
0755
internal
--
4 Dec 2025 6.06 PM
root / root
0755
mail
--
16 Dec 2025 9.30 PM
root / root
0755
netip
--
16 Dec 2025 9.30 PM
root / root
0755
rpc
--
16 Dec 2025 9.30 PM
root / root
0755
smtp
--
16 Dec 2025 9.30 PM
root / root
0755
textproto
--
16 Dec 2025 9.30 PM
root / root
0755
url
--
16 Dec 2025 9.30 PM
root / root
0755
addrselect.go
9.452 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_aix.go
0.568 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_android.go
0.266 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_bsd.go
0.335 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_darwin.go
0.291 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_linux.go
0.627 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_netbsd.go
0.27 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_openbsd.go
0.27 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_resnew.go
0.566 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_resold.go
0.565 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_socknew.go
0.735 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_sockold.go
0.822 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_solaris.go
0.324 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_stub.go
1.331 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_unix.go
11.618 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_unix_cgo.go
2.424 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_unix_cgo_res.go
0.871 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_unix_cgo_resn.go
0.956 KB
4 Dec 2025 6.06 PM
root / root
0644
cgo_unix_syscall.go
3.061 KB
4 Dec 2025 6.06 PM
root / root
0644
conf.go
15.892 KB
4 Dec 2025 6.06 PM
root / root
0644
dial.go
28.603 KB
4 Dec 2025 6.06 PM
root / root
0644
dnsclient.go
5.672 KB
4 Dec 2025 6.06 PM
root / root
0644
dnsclient_unix.go
24.666 KB
4 Dec 2025 6.06 PM
root / root
0644
dnsconfig.go
2.186 KB
4 Dec 2025 6.06 PM
root / root
0644
dnsconfig_unix.go
4.12 KB
4 Dec 2025 6.06 PM
root / root
0644
dnsconfig_windows.go
1.606 KB
4 Dec 2025 6.06 PM
root / root
0644
error_plan9.go
0.219 KB
4 Dec 2025 6.06 PM
root / root
0644
error_posix.go
0.53 KB
4 Dec 2025 6.06 PM
root / root
0644
error_unix.go
0.373 KB
4 Dec 2025 6.06 PM
root / root
0644
error_windows.go
0.347 KB
4 Dec 2025 6.06 PM
root / root
0644
fd_fake.go
3.874 KB
4 Dec 2025 6.06 PM
root / root
0644
fd_js.go
0.612 KB
4 Dec 2025 6.06 PM
root / root
0644
fd_plan9.go
3.723 KB
4 Dec 2025 6.06 PM
root / root
0644
fd_posix.go
4.557 KB
4 Dec 2025 6.06 PM
root / root
0644
fd_unix.go
5.244 KB
4 Dec 2025 6.06 PM
root / root
0644
fd_wasip1.go
0.484 KB
4 Dec 2025 6.06 PM
root / root
0644
fd_windows.go
7.496 KB
4 Dec 2025 6.06 PM
root / root
0644
file.go
1.674 KB
4 Dec 2025 6.06 PM
root / root
0644
file_plan9.go
2.769 KB
4 Dec 2025 6.06 PM
root / root
0644
file_posix.go
2.227 KB
4 Dec 2025 6.06 PM
root / root
0644
file_stub.go
0.47 KB
4 Dec 2025 6.06 PM
root / root
0644
file_unix.go
0.596 KB
4 Dec 2025 6.06 PM
root / root
0644
file_wasip1.go
2.196 KB
4 Dec 2025 6.06 PM
root / root
0644
file_windows.go
1.14 KB
4 Dec 2025 6.06 PM
root / root
0644
hook.go
0.912 KB
4 Dec 2025 6.06 PM
root / root
0644
hook_plan9.go
0.206 KB
4 Dec 2025 6.06 PM
root / root
0644
hook_unix.go
0.643 KB
4 Dec 2025 6.06 PM
root / root
0644
hook_windows.go
0.703 KB
4 Dec 2025 6.06 PM
root / root
0644
hosts.go
3.476 KB
4 Dec 2025 6.06 PM
root / root
0644
interface.go
7.624 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_aix.go
4.458 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_bsd.go
2.829 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_bsdvar.go
0.599 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_darwin.go
1.144 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_freebsd.go
1.145 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_linux.go
6.661 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_plan9.go
5.033 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_solaris.go
2.134 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_stub.go
0.795 KB
4 Dec 2025 6.06 PM
root / root
0644
interface_windows.go
5.493 KB
4 Dec 2025 6.06 PM
root / root
0644
ip.go
14.789 KB
4 Dec 2025 6.06 PM
root / root
0644
iprawsock.go
7.033 KB
4 Dec 2025 6.06 PM
root / root
0644
iprawsock_plan9.go
0.854 KB
4 Dec 2025 6.06 PM
root / root
0644
iprawsock_posix.go
3.895 KB
4 Dec 2025 6.06 PM
root / root
0644
ipsock.go
9.428 KB
4 Dec 2025 6.06 PM
root / root
0644
ipsock_plan9.go
7.566 KB
4 Dec 2025 6.06 PM
root / root
0644
ipsock_posix.go
8.796 KB
4 Dec 2025 6.06 PM
root / root
0644
lookup.go
29.062 KB
4 Dec 2025 6.06 PM
root / root
0644
lookup_plan9.go
9.768 KB
4 Dec 2025 6.06 PM
root / root
0644
lookup_unix.go
3.327 KB
4 Dec 2025 6.06 PM
root / root
0644
lookup_windows.go
13.514 KB
4 Dec 2025 6.06 PM
root / root
0644
mac.go
1.879 KB
4 Dec 2025 6.06 PM
root / root
0644
mptcpsock_linux.go
4.133 KB
4 Dec 2025 6.06 PM
root / root
0644
mptcpsock_stub.go
0.529 KB
4 Dec 2025 6.06 PM
root / root
0644
net.go
27.689 KB
4 Dec 2025 6.06 PM
root / root
0644
net_fake.go
26.446 KB
4 Dec 2025 6.06 PM
root / root
0644
netcgo_off.go
0.217 KB
4 Dec 2025 6.06 PM
root / root
0644
netcgo_on.go
0.215 KB
4 Dec 2025 6.06 PM
root / root
0644
netgo_netcgo.go
0.442 KB
4 Dec 2025 6.06 PM
root / root
0644
netgo_off.go
0.215 KB
4 Dec 2025 6.06 PM
root / root
0644
netgo_on.go
0.213 KB
4 Dec 2025 6.06 PM
root / root
0644
nss.go
5.482 KB
4 Dec 2025 6.06 PM
root / root
0644
parse.go
5.655 KB
4 Dec 2025 6.06 PM
root / root
0644
pipe.go
5.435 KB
4 Dec 2025 6.06 PM
root / root
0644
port.go
1.458 KB
4 Dec 2025 6.06 PM
root / root
0644
port_unix.go
1.239 KB
4 Dec 2025 6.06 PM
root / root
0644
rawconn.go
2.7 KB
4 Dec 2025 6.06 PM
root / root
0644
rlimit_js.go
0.338 KB
4 Dec 2025 6.06 PM
root / root
0644
rlimit_unix.go
1.101 KB
4 Dec 2025 6.06 PM
root / root
0644
sendfile.go
1.391 KB
4 Dec 2025 6.06 PM
root / root
0644
sendfile_nonwindows.go
0.353 KB
4 Dec 2025 6.06 PM
root / root
0644
sendfile_stub.go
0.409 KB
4 Dec 2025 6.06 PM
root / root
0644
sendfile_windows.go
0.558 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_bsd.go
0.896 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_cloexec.go
0.713 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_cloexec_solaris.go
1.433 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_linux.go
0.97 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_plan9.go
0.256 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_posix.go
6.288 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_stub.go
0.381 KB
4 Dec 2025 6.06 PM
root / root
0644
sock_windows.go
0.783 KB
4 Dec 2025 6.06 PM
root / root
0644
sockaddr_posix.go
1.45 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_aix.go
1.434 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_bsd.go
2.21 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_fake.go
0.933 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_linux.go
1.253 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_plan9.go
0.396 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_posix.go
1.579 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_solaris.go
1.253 KB
4 Dec 2025 6.06 PM
root / root
0644
sockopt_windows.go
1.509 KB
4 Dec 2025 6.06 PM
root / root
0644
sockoptip4_bsdvar.go
0.847 KB
4 Dec 2025 6.06 PM
root / root
0644
sockoptip4_linux.go
1.055 KB
4 Dec 2025 6.06 PM
root / root
0644
sockoptip4_posix_nonlinux.go
1.146 KB
4 Dec 2025 6.06 PM
root / root
0644
sockoptip4_windows.go
0.768 KB
4 Dec 2025 6.06 PM
root / root
0644
sockoptip6_posix.go
1.025 KB
4 Dec 2025 6.06 PM
root / root
0644
sockoptip_stub.go
0.751 KB
4 Dec 2025 6.06 PM
root / root
0644
splice_linux.go
1.715 KB
4 Dec 2025 6.06 PM
root / root
0644
splice_stub.go
0.367 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_cloexec.go
0.939 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsock.go
14.016 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsock_plan9.go
2.299 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsock_posix.go
6.272 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsock_solaris.go
1.318 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsock_unix.go
1.053 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsock_windows.go
1.312 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_darwin.go
1.402 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_openbsd.go
0.741 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_plan9.go
0.744 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_posix.go
0.432 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_solaris.go
3.349 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_stub.go
0.557 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_unix.go
1.324 KB
4 Dec 2025 6.06 PM
root / root
0644
tcpsockopt_windows.go
3.758 KB
4 Dec 2025 6.06 PM
root / root
0644
udpsock.go
11.862 KB
4 Dec 2025 6.06 PM
root / root
0644
udpsock_plan9.go
4.639 KB
4 Dec 2025 6.06 PM
root / root
0644
udpsock_posix.go
7.526 KB
4 Dec 2025 6.06 PM
root / root
0644
unixsock.go
10.252 KB
4 Dec 2025 6.06 PM
root / root
0644
unixsock_plan9.go
1.243 KB
4 Dec 2025 6.06 PM
root / root
0644
unixsock_posix.go
6.642 KB
4 Dec 2025 6.06 PM
root / root
0644
unixsock_readmsg_cloexec.go
0.639 KB
4 Dec 2025 6.06 PM
root / root
0644
unixsock_readmsg_cmsg_cloexec.go
0.324 KB
4 Dec 2025 6.06 PM
root / root
0644
unixsock_readmsg_other.go
0.269 KB
4 Dec 2025 6.06 PM
root / root
0644
writev_unix.go
0.65 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF