添加新的网口标识

This commit is contained in:
nnbcccscdscdsc
2026-03-23 20:50:44 +08:00
parent 4824675244
commit 2dd33bf73e
4 changed files with 123 additions and 8 deletions

View File

@@ -19,12 +19,14 @@ func main() {
targetPeer := flag.String("to", "", "optional target peer for one outgoing message") // 可选的目标 peer 标识
text := flag.String("text", "", "optional text to send after connecting") // 可选的文本消息内容
filePath := flag.String("file", "", "optional file path to send after connecting")
bindIP := flag.String("bind-ip", "", "optional local source IP used when dialing the server")
bindDevice := flag.String("bind-device", "", "optional Linux network device used when dialing the server")
inboxDir := flag.String("inbox-dir", "inbox", "directory used to persist received text and file messages")
logPath := flag.String("latency-log", "", "optional JSONL file path for latency timestamp logs")
interactive := flag.Bool("interactive", true, "enable interactive REPL for repeated text/file sends on the same connection")
flag.Parse()
clientOptions := make([]peerpkg.Option, 0, 1)
clientOptions := make([]peerpkg.Option, 0, 3)
if *logPath != "" {
logger, err := latencylog.NewJSONLLogger(*logPath)
if err != nil {
@@ -33,6 +35,12 @@ func main() {
defer logger.Close()
clientOptions = append(clientOptions, peerpkg.WithLogger(logger))
}
if *bindIP != "" {
clientOptions = append(clientOptions, peerpkg.WithBindIP(*bindIP))
}
if *bindDevice != "" {
clientOptions = append(clientOptions, peerpkg.WithBindDevice(*bindDevice))
}
client, err := peerpkg.Dial(*serverAddr, *peerID, clientOptions...)
if err != nil {