You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
437 B
Go
28 lines
437 B
Go
2 years ago
|
package net
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
type SimpleNatClient struct {
|
||
|
mu sync.RWMutex
|
||
|
cmdTCPConn net.Conn
|
||
|
cmdUDPConn *net.UDPAddr
|
||
|
ServiceTarget string
|
||
|
CmdTarget string
|
||
|
tcpAlived bool
|
||
|
}
|
||
|
|
||
|
func (s *SimpleNatClient) tcpCmdConn() net.Conn {
|
||
|
s.mu.RLock()
|
||
|
defer s.mu.RUnlock()
|
||
|
return s.cmdTCPConn
|
||
|
}
|
||
|
|
||
|
func (s *SimpleNatClient) tcpCmdConnAlived() bool {
|
||
|
s.mu.RLock()
|
||
|
defer s.mu.RUnlock()
|
||
|
return s.tcpAlived
|
||
|
}
|