1
This commit is contained in:
parent
c796300e9b
commit
1e9ba955c3
5 changed files with 38 additions and 51 deletions
|
|
@ -1,36 +1,38 @@
|
||||||
// go: ignore
|
//go:build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// import (
|
import (
|
||||||
// "encoding/hex"
|
"encoding/hex"
|
||||||
// "fmt"
|
"fmt"
|
||||||
// "time"
|
"time"
|
||||||
|
|
||||||
// "github.com/zeevdiukman/z/crypt"
|
"github.com/zeevdiukman/z/crypt"
|
||||||
// "github.com/zeevdiukman/z/helper"
|
"github.com/zeevdiukman/z/helper"
|
||||||
// )
|
)
|
||||||
|
|
||||||
// func main() {
|
func main() {
|
||||||
// t := time.Now()
|
var _ = crypt.Encrypt
|
||||||
// key := "1b1ef1cf714a412d57ec7be1647e6e1e7f8141a1cd009dd13b52041e5c62dbd6"
|
t := time.Now()
|
||||||
// keyBytes, _ := hex.DecodeString(key)
|
key := "1b1ef1cf714a412d57ec7be1647e6e1e7f8141a1cd009dd13b52041e5c62dbd6"
|
||||||
// plaintext := "hello, world!"
|
keyBytes, _ := hex.DecodeString(key)
|
||||||
// encryptedText, err := crypt.Encrypt(plaintext, keyBytes)
|
plaintext := "hello, world!"
|
||||||
|
encryptedText, err := crypt.Encrypt(plaintext, keyBytes)
|
||||||
|
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// fmt.Println("Error encrypting:", err)
|
fmt.Println("Error encrypting:", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// decryptedText, err := crypt.Decrypt(encryptedText, keyBytes)
|
decryptedText, err := crypt.Decrypt(encryptedText, keyBytes)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// fmt.Println("Error decrypting:", err)
|
fmt.Println("Error decrypting:", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// tt := time.Since(t)
|
tt := time.Since(t)
|
||||||
|
|
||||||
// fmt.Println("Key:", key)
|
fmt.Println("Key:", key)
|
||||||
// fmt.Println("Encrypted:", encryptedText)
|
fmt.Println("Encrypted:", encryptedText)
|
||||||
// fmt.Println("Decrypted:", decryptedText)
|
fmt.Println("Decrypted:", decryptedText)
|
||||||
// fmt.Println("Generated in", tt)
|
fmt.Println("Generated in", tt)
|
||||||
// helper.PrintOldStyleMetrics()
|
helper.PrintOldStyleMetrics()
|
||||||
// }
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
//go:build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -5,11 +7,6 @@ import (
|
||||||
"github.com/zeevdiukman/z/helper"
|
"github.com/zeevdiukman/z/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServeDNS calls f(w, r).
|
|
||||||
//
|
|
||||||
// func (f dns.HandlerFunc) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
|
|
||||||
// f(w, r)
|
|
||||||
// }
|
|
||||||
func main() {
|
func main() {
|
||||||
dnsApp := dns.New()
|
dnsApp := dns.New()
|
||||||
dnsApp.Mux.HandleFunc(".", dnsApp.HandleTypeA)
|
dnsApp.Mux.HandleFunc(".", dnsApp.HandleTypeA)
|
||||||
|
|
|
||||||
3
go.work
3
go.work
|
|
@ -2,7 +2,8 @@ go 1.23.0
|
||||||
|
|
||||||
use (
|
use (
|
||||||
./
|
./
|
||||||
./pkg/crypt
|
|
||||||
./pkg/dns
|
./pkg/dns
|
||||||
./pkg/helper
|
./pkg/helper
|
||||||
|
./pkg/crypt
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
15
main.go
15
main.go
|
|
@ -1,18 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/zeevdiukman/z/dns"
|
|
||||||
"github.com/zeevdiukman/z/helper"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ServeDNS calls f(w, r).
|
|
||||||
//
|
|
||||||
// func (f dns.HandlerFunc) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
|
|
||||||
// f(w, r)
|
|
||||||
// }
|
|
||||||
func main() {
|
func main() {
|
||||||
dnsApp := dns.New()
|
|
||||||
dnsApp.Mux.HandleFunc(".", dnsApp.HandleTypeA)
|
|
||||||
go dnsApp.Run()
|
|
||||||
helper.StartHTTP()
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package zcrypt
|
package crypt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
Loading…
Reference in a new issue