No description
Find a file
2024-09-26 17:03:02 +03:00
pkg Update go.mod 2024-09-26 17:03:02 +03:00
.air.toml f 2024-09-10 02:53:02 +00:00
.gitignore 3 2024-09-10 12:22:18 +00:00
go.mod 1 2024-09-10 13:52:36 +00:00
go.sum 1 2024-09-10 13:52:36 +00:00
go.work 1 2024-09-10 13:51:05 +00:00
go.work.sum 1 2024-09-10 13:52:36 +00:00
main.go 1 2024-09-10 13:51:05 +00:00
README.md 1 2024-09-10 13:59:24 +00:00
records.yaml order1 2024-09-10 13:35:53 +00:00
z.code-workspace order1 2024-09-10 13:35:53 +00:00

Z library

dns example

package main

import (
	"github.com/zeevdiukman/z/dns"
	"github.com/zeevdiukman/z/helper"
)

func main() {
	dnsApp := dns.New()
	dnsApp.Mux.HandleFunc(".", dnsApp.HandleTypeA)
	go dnsApp.Run()
	helper.StartHTTP()
}

crypt example


package main

import (
	"encoding/hex"
	"fmt"
	"time"

	"github.com/zeevdiukman/z/crypt"
	"github.com/zeevdiukman/z/helper"
)

func main() {
	var _ = crypt.Encrypt
	t := time.Now()
	key := "1b1ef1cf714a412d57ec7be1647e6e1e7f8141a1cd009dd13b52041e5c62dbd6"
	keyBytes, _ := hex.DecodeString(key)
	plaintext := "hello, world!"
	encryptedText, err := crypt.Encrypt(plaintext, keyBytes)

	if err != nil {
		fmt.Println("Error encrypting:", err)
		return
	}
	decryptedText, err := crypt.Decrypt(encryptedText, keyBytes)
	if err != nil {
		fmt.Println("Error decrypting:", err)
		return
	}
	tt := time.Since(t)

	fmt.Println("Key:", key)
	fmt.Println("Encrypted:", encryptedText)
	fmt.Println("Decrypted:", decryptedText)
	fmt.Println("Generated in", tt)
	helper.PrintOldStyleMetrics()
}