Documentation
¶
Overview ¶
mimixbox/internal/lib/common.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/crypto.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/file.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/gnu.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/id.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/net.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/option.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/path.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/shadow.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/shell.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/signal.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/string.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mimixbox/internal/lib/type.go
Copyright 2021 Naohiro CHIKAMATSU ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func AddLineFeed(lines []string) []string
- func BaseNameWithoutExt(path string) string
- func CalcChecksum(hash hash.Hash, path string) (string, error)
- func ChecksumOutput(hash hash.Hash, r io.Reader, path string) error
- func Chop(line string) string
- func ChopAll(lines []string) []string
- func CompareChecksum(h hash.Hash, paths []string) error
- func Concatenate(path []string) ([]string, error)
- func Contains(list interface{}, elem interface{}) bool
- func ConvSignalNameToNum(name string) int32
- func Copy(src string, dest string) error
- func Dump(lines []string, withNumber bool)
- func DumpGroups(groups []user.Group, showName bool)
- func ExistCmd(cmd string) bool
- func Exists(path string) bool
- func FromPIPE() (string, error)
- func Groups(uname string) ([]user.Group, error)
- func HasHelpOpt(args []string) bool
- func HasNoOperand(args []string, cmdName string) bool
- func HasOperand(args []string, cmdName string) bool
- func HasPipeData() bool
- func HasVersionOpt(args []string) bool
- func Input() (string, bool)
- func Ip4() ([]string, error)
- func IsDir(path string) bool
- func IsExecutable(path string) bool
- func IsFile(path string) bool
- func IsHiddenFile(filePath string) bool
- func IsNamedPipe(path string) bool
- func IsReadable(path string) bool
- func IsRootDir(path string) bool
- func IsRootUser() bool
- func IsSameFileName(src string, dest string) bool
- func IsSamePath(src string, dest string) bool
- func IsSignalName(name string) bool
- func IsSignalNumber(num string) bool
- func IsSymlink(path string) bool
- func IsWritable(path string) bool
- func IsZero(path string) bool
- func ListDigit(strList []string) string
- func ListToFile(filepath string, lines []string) error
- func LookupGid(groupId string) (int, error)
- func LookupUid(userId string) (int, error)
- func Parrot(withNl bool)
- func PrintChecksums(cmdName string, hash hash.Hash, paths []string) (int, error)
- func PrintSignal(numOrName string)
- func PrintSignalList()
- func PrintStrListWithNumberLine(strList []string, countEmpryLine bool)
- func PrintStrWithNumberLine(nl int, format string, message string)
- func Question(ask string) bool
- func ReadFileToStrList(path string) ([]string, error)
- func Remove(strings []string, target string) []string
- func RemoveDir(dir string, interactive bool) error
- func RemoveFile(path string, interactive bool) error
- func ReplaceAll(lines []string, target string, after string) []string
- func ShowVersion(cmdName string, version string)
- func SignalAtoi(num string) int32
- func SimpleBackupSuffix() string
- func Size(path string) (int64, error)
- func TmpShellsFile() string
- func TopDirName(path string) string
- func Walk(dir string, ignoreErr bool) ([]string, []string, error)
- func WithSingleCoat(str string) string
- func WrapString(src string, column int) string
Constants ¶
const ( // Unknown : Don't use this bits Unknown os.FileMode = 1 << (9 - iota) // Readable : readable bits Readable // Writable : writable bits Writable // Executable : executable bits Executable )
const ShellsFilePath = "/etc/shells"
Variables ¶
var Signals []signal = []signal{
{"1", "SIGHUP", "Hangup detected on controlling terminal or death of controlling process"},
{"2", "SIGINT", "The process was interrupted (When user hits Cnrl+C)"},
{"3", "SIGQUIT", "Quit program"},
{"4", "SIGILL", "Illegal instruction"},
{"5", "SIGTRAP", "Trace trap for debugging"},
{"6", "SIGABRT", "Emegency stop. Abort program (formerly SIGIOT)"},
{"7", "SIGBUS", "Bus error. e.g. alignment errors in memory access"},
{"8", "SIGFPE", "A floating point exception happened in the program."},
{"9", "SIGKILL", "Kill program"},
{"10", "SIGUSR1", "Left for the programmers to do whatever they want"},
{"11", "SIGSEGV", "Segmentation violation"},
{"12", "SIGUSR2", "Left for the programmers to do whatever they want"},
{"13", "SIGPIPE", "Write on a pipe with no reader"},
{"14", "SIGALRM", "Real-time timer (request a wake up call) expired"},
{"15", "SIGTERM", "Software termination"},
{"16", "SIGSTKFLT", "Unused (Stack fault in the FPU)"},
{"17", "SIGCHLD", "Stop or exit child process"},
{"18", "SIGCONT", "Restart from stop"},
{"19", "SIGSTOP", "Stop process"},
{"20", "SIGTSTP", "Stop process from terminal (When user hits Cnrl+Z)"},
{"21", "SIGTTIN", "Signal to a backgrounded process when it tries to read input from its terminal"},
{"22", "SIGTTOU", "Signal to a backgrounded process when it tries to write output to its terminal"},
{"23", "SIGURG", "Network connection when urgent out of band data is sent to it"},
{"24", "SIGXCPU", "Exceeded CPU limit"},
{"25", "SIGXFSZ", "Exceeded file size limit"},
{"26", "SIGVTALRM", "Virtual alram cloc"},
{"27", "SIGPROF", "Profiling timer's timeout"},
{"28", "SIGWINCH", "Window resize signal"},
{"29", "SIGIO", "Input / output is possible"},
{"30", "SIGPWR", "Power failure"},
{"31", "SIGSYS", "Unused (Illegal argument to routine)"},
}
[Reference] https://www-uxsup.csx.cam.ac.uk/courses/moved.Building/signals.pdf
Functions ¶
func AddLineFeed ¶
func BaseNameWithoutExt ¶
BaseNameWithoutExt return file name without extension.
func ChecksumOutput ¶ added in v0.25.1
func CompareChecksum ¶ added in v0.25.1
e.g. hash is md5.New(), md5.New(), sha512.New(), etc...
func Concatenate ¶
func ConvSignalNameToNum ¶ added in v0.31.1
func DumpGroups ¶ added in v0.22.0
func HasHelpOpt ¶
func HasNoOperand ¶ added in v0.29.0
func HasOperand ¶ added in v0.29.0
func HasPipeData ¶
func HasPipeData() bool
func HasVersionOpt ¶
func IsExecutable ¶
IsExecutable reports whether the path exists and is executable.
func IsHiddenFile ¶
IsHiddenFile reports whether the path exists and is included hidden file.
func IsNamedPipe ¶ added in v0.29.0
func IsReadable ¶
IsReadable reports whether the path exists and is readable.
func IsRootUser ¶
func IsRootUser() bool
func IsSameFileName ¶
IsSameFileName return true if src and dest is same name, false if src and dest is not same name
func IsSamePath ¶
IsSamePath return true if src and dest is same path, false if src and dest is not same path or error occur
func IsSignalName ¶ added in v0.31.1
func IsSignalNumber ¶ added in v0.31.1
func IsWritable ¶
IsWritable reports whether the path exists and is writable.
func ListToFile ¶ added in v0.22.0
func PrintChecksums ¶ added in v0.27.19
func PrintSignal ¶ added in v0.31.1
func PrintSignal(numOrName string)
func PrintSignalList ¶ added in v0.31.1
func PrintSignalList()
func PrintStrWithNumberLine ¶
func ReadFileToStrList ¶
func RemoveFile ¶ added in v0.22.0
func ReplaceAll ¶ added in v0.22.0
func ShowVersion ¶ added in v0.22.0
func SignalAtoi ¶ added in v0.31.1
func SimpleBackupSuffix ¶
func SimpleBackupSuffix() string
func TmpShellsFile ¶ added in v0.31.1
func TmpShellsFile() string
func TopDirName ¶
TopDirName return top directory name from path.
func WithSingleCoat ¶ added in v0.32.1
func WrapString ¶
Types ¶
This section is empty.