Initial QSfera import

This commit is contained in:
Курнат Андрей
2026-06-07 10:20:04 +03:00
commit 2315f25754
16485 changed files with 4826827 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
+18
View File
@@ -0,0 +1,18 @@
language: go
go:
- '1.13'
- '1.14'
- '1.15'
- '1.16'
- '1.17'
- '1.18'
- '1.19'
- tip
- master
go_import_path: github.com/longsleep/rndm
matrix:
allow_failures:
- go: tip master
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2017 - 2022 Kopano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+10
View File
@@ -0,0 +1,10 @@
# rndm [![GoDoc](https://godoc.org/github.com/longsleep/rndm?status.svg)](https://godoc.org/github.com/longsleep/rndm)
Rndm is a Go package to provide helper functions which create cryptographically
secure random values out of random data.
## Installation
```text
go get github.com/longsleep/rndm
```
+32
View File
@@ -0,0 +1,32 @@
/*
* Copyright 2017 Kopano
*
* Use of this source code is governed by a MIT license
* that can be found in the LICENSE.txt file.
*
*/
package rndm
import (
"crypto/rand"
)
// GenerateRandomBytes returns securely generated random bytes. It will panic
// when the system fails to provide enough secure random data.
func GenerateRandomBytes(n int) []byte {
b := make([]byte, n)
_, err := ReadRandomBytes(b)
if err != nil {
panic("unable to read enough random bytes")
}
return b
}
// ReadRandomBytes is a helper function that reads random data into the provided
// []byte. Tt returns the number of random bytes read and an error if fewer
// bytes were read.
func ReadRandomBytes(b []byte) (n int, err error) {
return rand.Read(b)
}
+9
View File
@@ -0,0 +1,9 @@
/*
* Copyright 2017 Kopano
*
* Use of this source code is governed by a MIT license
* that can be found in the LICENSE.txt file.
*
*/
package rndm // import "github.com/longsleep/rndm"
+22
View File
@@ -0,0 +1,22 @@
/*
* Copyright 2017 Kopano
*
* Use of this source code is governed by a MIT license
* that can be found in the LICENSE.txt file.
*
*/
package rndm
import (
"encoding/base64"
)
// GenerateRandomString returns a URL-safe, base64 encoded securely generated
// random string. It will panic if the system fails to provide secure random
// data.
func GenerateRandomString(s int) string {
b := GenerateRandomBytes(s)
return base64.RawURLEncoding.EncodeToString(b)
}