mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-06 21:37:38 +03:00
25 lines
390 B
Go
25 lines
390 B
Go
package tls
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
type Listener struct {
|
|
net.Listener
|
|
config ServerConfig
|
|
}
|
|
|
|
func NewListener(inner net.Listener, config ServerConfig) net.Listener {
|
|
l := new(Listener)
|
|
l.Listener = inner
|
|
l.config = config
|
|
return l
|
|
}
|
|
|
|
func (l *Listener) Accept() (net.Conn, error) {
|
|
conn, err := l.Listener.Accept()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return l.config.Server(conn)
|
|
}
|