mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
encrypt external ip
This commit is contained in:
parent
5fce2a2e27
commit
c3adc2981f
1 changed files with 3 additions and 1 deletions
|
@ -24,7 +24,6 @@ func (m Message) String() string {
|
||||||
|
|
||||||
// Send will send out
|
// Send will send out
|
||||||
func Send(c *comm.Comm, key []byte, m Message) (err error) {
|
func Send(c *comm.Comm, key []byte, m Message) (err error) {
|
||||||
log.Debugf("writing %s message", m.Type)
|
|
||||||
mSend, err := Encode(key, m)
|
mSend, err := Encode(key, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -41,7 +40,10 @@ func Encode(key []byte, m Message) (b []byte, err error) {
|
||||||
}
|
}
|
||||||
b = compress.Compress(b)
|
b = compress.Compress(b)
|
||||||
if key != nil {
|
if key != nil {
|
||||||
|
log.Debugf("writing %s message (encrypted)", m.Type)
|
||||||
b, err = crypt.Encrypt(b, key)
|
b, err = crypt.Encrypt(b, key)
|
||||||
|
} else {
|
||||||
|
log.Debugf("writing %s message", m.Type)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue