add security handler info to connection

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Василий Толстов 2017-07-05 16:08:27 +03:00
parent f77f8cec13
commit 88b99c68a5
4 changed files with 30 additions and 1 deletions

View File

@ -165,6 +165,17 @@ func (c *ClientConn) SetHeight(height uint16) {
c.fbHeight = height c.fbHeight = height
} }
// SecurityHandler returns security handler
func (c *ClientConn) SecurityHandler() SecurityHandler {
return c.securityHandler
}
// SetSecurityHandler sets security handler
func (c *ClientConn) SetSecurityHandler(sechandler SecurityHandler) error {
c.securityHandler = sechandler
return nil
}
// The ClientConn type holds client connection information // The ClientConn type holds client connection information
type ClientConn struct { type ClientConn struct {
c net.Conn c net.Conn
@ -186,6 +197,8 @@ type ClientConn struct {
// directly. Instead, SetEncodings() should be used. // directly. Instead, SetEncodings() should be used.
encodings []Encoding encodings []Encoding
securityHandler SecurityHandler
// Height of the frame buffer in pixels, sent from the server. // Height of the frame buffer in pixels, sent from the server.
fbHeight uint16 fbHeight uint16

View File

@ -26,4 +26,6 @@ type Conn interface {
Flush() error Flush() error
Wait() Wait()
SetProtoVersion(string) SetProtoVersion(string)
SetSecurityHandler(SecurityHandler) error
SecurityHandler() SecurityHandler
} }

View File

@ -165,7 +165,7 @@ func (*DefaultClientSecurityHandler) Handle(c Conn) error {
} }
return fmt.Errorf("%s", reasonText) return fmt.Errorf("%s", reasonText)
} }
c.SetSecurityHandler(secType)
return nil return nil
} }
@ -227,6 +227,7 @@ func (*DefaultServerSecurityHandler) Handle(c Conn) error {
} }
return authErr return authErr
} }
c.SetSecurityHandler(sType)
return nil return nil
} }

View File

@ -120,6 +120,17 @@ func (c *ServerConn) Protocol() string {
return c.protocol return c.protocol
} }
// SecurityHandler returns security handler
func (c *ServerConn) SecurityHandler() SecurityHandler {
return c.securityHandler
}
// SetSecurityHandler sets security handler
func (c *ServerConn) SetSecurityHandler(sechandler SecurityHandler) error {
c.securityHandler = sechandler
return nil
}
// SetWidth sets framebuffer width // SetWidth sets framebuffer width
func (c *ServerConn) SetWidth(w uint16) { func (c *ServerConn) SetWidth(w uint16) {
// TODO send desktopsize pseudo encoding // TODO send desktopsize pseudo encoding
@ -152,6 +163,8 @@ type ServerConn struct {
// directly. Instead, SetEncodings() should be used. // directly. Instead, SetEncodings() should be used.
encodings []Encoding encodings []Encoding
securityHandler SecurityHandler
// Height of the frame buffer in pixels, sent to the client. // Height of the frame buffer in pixels, sent to the client.
fbHeight uint16 fbHeight uint16