add security handler info to connection
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
parent
f77f8cec13
commit
88b99c68a5
13
client.go
13
client.go
@ -165,6 +165,17 @@ func (c *ClientConn) SetHeight(height uint16) {
|
||||
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
|
||||
type ClientConn struct {
|
||||
c net.Conn
|
||||
@ -186,6 +197,8 @@ type ClientConn struct {
|
||||
// directly. Instead, SetEncodings() should be used.
|
||||
encodings []Encoding
|
||||
|
||||
securityHandler SecurityHandler
|
||||
|
||||
// Height of the frame buffer in pixels, sent from the server.
|
||||
fbHeight uint16
|
||||
|
||||
|
2
conn.go
2
conn.go
@ -26,4 +26,6 @@ type Conn interface {
|
||||
Flush() error
|
||||
Wait()
|
||||
SetProtoVersion(string)
|
||||
SetSecurityHandler(SecurityHandler) error
|
||||
SecurityHandler() SecurityHandler
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ func (*DefaultClientSecurityHandler) Handle(c Conn) error {
|
||||
}
|
||||
return fmt.Errorf("%s", reasonText)
|
||||
}
|
||||
|
||||
c.SetSecurityHandler(secType)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -227,6 +227,7 @@ func (*DefaultServerSecurityHandler) Handle(c Conn) error {
|
||||
}
|
||||
return authErr
|
||||
}
|
||||
c.SetSecurityHandler(sType)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
13
server.go
13
server.go
@ -120,6 +120,17 @@ func (c *ServerConn) Protocol() string {
|
||||
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
|
||||
func (c *ServerConn) SetWidth(w uint16) {
|
||||
// TODO send desktopsize pseudo encoding
|
||||
@ -152,6 +163,8 @@ type ServerConn struct {
|
||||
// directly. Instead, SetEncodings() should be used.
|
||||
encodings []Encoding
|
||||
|
||||
securityHandler SecurityHandler
|
||||
|
||||
// Height of the frame buffer in pixels, sent to the client.
|
||||
fbHeight uint16
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user