mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-13 17:29:09 +07:00
feat: add sniffing suite and dial_mode option (#16)
This commit is contained in:
@ -6,10 +6,13 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"golang.org/x/net/dns/dnsmessage"
|
||||
"net/netip"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
@ -374,3 +377,19 @@ func ConvergeIp(addr netip.Addr) netip.Addr {
|
||||
}
|
||||
return addr
|
||||
}
|
||||
|
||||
func NewGcm(key []byte) (cipher.AEAD, error) {
|
||||
block, err := aes.NewCipher(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cipher.NewGCM(block)
|
||||
}
|
||||
|
||||
func AddrToDnsType(addr netip.Addr) dnsmessage.Type {
|
||||
if addr.Is4() {
|
||||
return dnsmessage.TypeA
|
||||
} else {
|
||||
return dnsmessage.TypeAAAA
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user