@@ -37,9 +37,6 @@ type Conn interface {
3737 IsState (states ... State ) bool
3838 GetState () State
3939 SetState (State ) State
40-
41- Close (ctx context.Context ) error
42- Park (ctx context.Context ) error
4340}
4441
4542func (c * conn ) Address () string {
@@ -56,7 +53,7 @@ type conn struct {
5653 state State
5754 usages int32
5855 ttl timeutil.Timer
59- onClose []func (Conn )
56+ onClose []func (* conn )
6057}
6158
6259func (c * conn ) IsState (states ... State ) bool {
@@ -426,21 +423,21 @@ func (c *conn) NewStream(
426423
427424type option func (c * conn )
428425
429- func withOnClose (onClose func (Conn )) option {
426+ func withOnClose (onClose func (* conn )) option {
430427 return func (c * conn ) {
431428 if onClose != nil {
432429 c .onClose = append (c .onClose , onClose )
433430 }
434431 }
435432}
436433
437- func New (e endpoint.Endpoint , config Config , opts ... option ) Conn {
434+ func newConn (e endpoint.Endpoint , config Config , opts ... option ) * conn {
438435 c := & conn {
439436 state : Created ,
440437 endpoint : e ,
441438 config : config ,
442439 done : make (chan struct {}),
443- onClose : make ([]func (Conn ), 0 ),
440+ onClose : make ([]func (* conn ), 0 ),
444441 }
445442 for _ , o := range opts {
446443 o (c )
@@ -450,3 +447,7 @@ func New(e endpoint.Endpoint, config Config, opts ...option) Conn {
450447 }
451448 return c
452449}
450+
451+ func New (e endpoint.Endpoint , config Config , opts ... option ) Conn {
452+ return newConn (e , config , opts ... )
453+ }
0 commit comments