Skip to content

Commit

Permalink
fix hard code.
Browse files Browse the repository at this point in the history
  • Loading branch information
kitech committed Jun 21, 2016
1 parent 23290d3 commit c732514
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

const (
toxtunid = "A90BE3636C169E5991C910950E90C7524C83460971F6D710D6AC0591B8A7B62235B0BE180AC5"
// toxtunid = "A90BE3636C169E5991C910950E90C7524C83460971F6D710D6AC0591B8A7B62235B0BE180AC5"
)

type TunnelRecord struct {
Expand Down
8 changes: 5 additions & 3 deletions tunnelc.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,9 @@ func (this *Tunnelc) initConnChanel(conn net.Conn, times int, btime time.Time) {
ch.port = fmt.Sprintf("%d", config.recs[0].rport)
this.chpool.putClient(ch)

// toxid := toxtunid
toxid := config.recs[0].rpubkey
toxtunid := config.recs[0].rpubkey
pkt := ch.makeConnectSYNPacket()
_, err := this.FriendSendMessage(toxid, string(pkt.toJson()))
_, err := this.FriendSendMessage(toxtunid, string(pkt.toJson()))

if err != nil {
// 连接失败
Expand Down Expand Up @@ -240,6 +239,7 @@ func (this *Tunnelc) onKcpOutput(buf []byte, size int, extra interface{}) {
if _, ok := extra.(*Channel); !ok {
}

toxtunid := config.recs[0].rpubkey
msg := string([]byte{254}) + string(buf[:size])
err := this.FriendSendLossyPacket(toxtunid, msg)
// msg := string([]byte{191}) + string(buf[:size])
Expand Down Expand Up @@ -283,6 +283,7 @@ func (this *Tunnelc) pollClientReadyRead(ch *Channel) {

func (this *Tunnelc) promiseChannelClose(ch *Channel) {
info.Println("cleaning up:", ch.chidcli, ch.chidsrv, ch.conv)
toxtunid := config.recs[0].rpubkey
if ch.client_socket_close == true && ch.server_socket_close == false {
pkt := ch.makeCloseFINPacket()
_, err := this.FriendSendMessage(toxtunid, string(pkt.toJson()))
Expand Down Expand Up @@ -340,6 +341,7 @@ func (this *Tunnelc) copyServer2Client(ch *Channel, pkt *Packet) {

//////////////
func (this *Tunnelc) onToxnetSelfConnectionStatus(t *tox.Tox, status uint32, extra interface{}) {
toxtunid := config.recs[0].rpubkey
_, err := t.FriendByPublicKey(toxtunid)
if err != nil {
t.FriendAdd(toxtunid, "tuncli")
Expand Down

0 comments on commit c732514

Please sign in to comment.