can not get LocalAddr in stun package
lluck42 opened this issue · comments
lluck42 commented
// Client simulates "connection" to STUN server.
type Client struct {
rto int64 // time.Duration
a ClientAgent
c Connection
close chan struct{}
rtoRate time.Duration
maxAttempts int32
closed bool
closeConn bool // should call c.Close() while closing
wg sync.WaitGroup
clock Clock
handler Handler
collector Collector
t map[transactionID]*clientTransaction
// mux guards closed and t
mux sync.RWMutex
}
there the “c” is a small letter
and find not a func to get “conn“
Aleksandr Razumov commented
Hi, thank you for reporting the issue.
Please use the NewClient function to pass your own connection instead, you'll have more control on it in that case.
I can add the Connection
and LocalAddr
helpers for client so this is not needed, but seems like it won't help in common use case. Please share how you want to use the obtained local address value so I can understand the context better.
lluck42 commented
Use for create new net.Dealer with the LocalAddr.
And use it to ice NAT, deal with local and NAT ports are different.
And I can’t know if it will works...
发送自 Windows 10 版邮件应用
发件人: Aleksandr Razumov
发送时间: 2019年8月9日 4:47
收件人: gortc/stun
抄送: lluck42; Author
主题: Re: [gortc/stun] can not get LocalAddr in stun package (#66)
Hi, thank you for reporting the issue.
Please use the NewClient function to pass your own connection.
I can add the Connection and LocalAddr helpers for client so this is not needed, but seems like it won't help in common use case. Please share how you want to use the obtained local address value so I can understand the context better.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Aleksandr Razumov commented
Please take a look at cmd/stun-traversal example, that should help.
Also you can take a look at pion/webrtc project, it can handle NAT traversal automatically.