func (params protocolIntroParams) doIntro() (res protocolIntroResults, err error) {
	if err = params.Conn.SetDeadline(time.Now().Add(headerTimeout)); err != nil {
		return
	}

	if res.Version, err = params.exchangeProtocolHeader(); err != nil {
		return
	}

	var pubKey, privKey *[32]byte
	if params.Password != nil {
		if pubKey, privKey, err = generateKeyPair(); err != nil {
			return
		}
	}

	if err = params.Conn.SetWriteDeadline(time.Time{}); err != nil {
		return
	}
	if err = params.Conn.SetReadDeadline(time.Now().Add(tcpHeartbeat * 2)); err != nil {
		return
	}

	switch res.Version {
	case 1:
		err = res.doIntroV1(params, pubKey, privKey)
	case 2:
		err = res.doIntroV2(params, pubKey, privKey)
	default:
		panic("unhandled protocol version")
	}

	return
}
func (params protocolIntroParams) doIntro() (res protocolIntroResults, err error) {
	if err = params.Conn.SetDeadline(time.Now().Add(headerTimeout)); err != nil {
		return
	}

	if res.Version, err = params.exchangeProtocolHeader(); err != nil {
		return
	}

	var pubKey, privKey *[32]byte
	if params.Password != nil {
		if pubKey, privKey, err = generateKeyPair(); err != nil {
			return
		}
	}

	if err = params.Conn.SetWriteDeadline(time.Time{}); err != nil {
		return
	}
	if err = params.Conn.SetReadDeadline(time.Now().Add(tcpHeartbeat * 2)); err != nil {
		return
	}

	switch res.Version {
	case 1:
		err = res.doIntroV1(params, pubKey, privKey)
	case 2:
		err = res.doIntroV2(params, pubKey, privKey)
	default:
		panic("unhandled protocol version")
	}

	return
}
func ( params protocolIntroParams ) doIntro ( ) ( res protocolIntroResults , err error ) { if err = params . Conn . SetDeadline ( time . Now ( ) . Add ( headerTimeout ) ) ; err != nil { return } if res . Version , err = params . exchangeProtocolHeader ( ) ; err != nil { return } var pubKey , privKey * [ 32 ] byte if params . Password != nil { if pubKey , privKey , err = generateKeyPair ( ) ; err != nil { return } } if err = params . Conn . SetWriteDeadline ( time . Time { } ) ; err != nil { return } if err = params . Conn . SetReadDeadline ( time . Now ( ) . Add ( tcpHeartbeat * 2 ) ) ; err != nil { return } switch res . Version { case 1 : err = res . doIntroV1 ( params , pubKey , privKey ) case 2 : err = res . doIntroV2 ( params , pubKey , privKey ) default : panic ( " " ) } return }
// DoIntro executes the protocol introduction.
DoIntro executes the protocol introduction .