PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.
Dart airdrop-alternativeclipboardclipboard-sharingclipboard-synccopy-pastecross-platformend-to-end-encryptionfile-syncfile-transferfluttergolanglinuxmacosnat-traversalp2pself-hostedtailscaleuniversal-clipboardwebrtcwindows
feat(core): send files to friends
baiyuze6ff798b3c9fb
diff --git a/client-core/cmd/pasteferry-cli/friends.go b/client-core/cmd/pasteferry-cli/friends.gonew file mode 100644index 0000000..9087b57--- /dev/null+++ b/client-core/cmd/pasteferry-cli/friends.go@@ -0,0 +1,260 @@+package main++import (+ "bufio"+ "context"+ "errors"+ "fmt"+ "os"+ "strings"+ "time"++ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// 好友(2.6.0):friends、friend code|add|remove|auto、accept、decline、name、receive-from++func showFriends(ctx context.Context, c pb.DaemonServiceClient) error {+ p, err := c.GetProfile(ctx, &pb.Empty{})+ if err != nil {+ return err+ }+ fmt.Printf("本机显示为 %s(头像:%v)\n\n", p.GetDisplayName(), p.GetHasAvatar())+ resp, err := c.ListFriends(ctx, &pb.Empty{})+ if err != nil {+ return err+ }+ if len(resp.GetFriends()) == 0 {+ fmt.Println("(还没有好友,用 friend code / friend add CODE 添加)")+ return nil+ }+ for _, f := range resp.GetFriends() {+ state := "离线"+ if f.GetOnline() {+ state = map[pb.ConnectionKind]string{pb.ConnectionKind_CONNECTION_KIND_DIRECT: "直连",+ pb.ConnectionKind_CONNECTION_KIND_RELAY: "中转"}[f.GetConnection()]+ if state == "" {+ state = "在线"+ }+ }+ recv := "收文件"+ switch {+ case !f.GetFeaturesKnown():+ recv = "未知"+ case f.GetReceiveDisabled():+ recv = "不收文件"+ case !f.GetReceivesFiles():+ recv = "需要更新"+ }+ extra := ""+ if f.GetAutoAccept() {+ extra += " 自动接收"+ }+ if f.GetReachability() != "" {+ extra += " " + f.GetReachability()+ }+ fmt.Printf("%-12s %-16s %-6s %-6s %-8s %s%s\n", f.GetDisplayName(), f.GetDeviceName(), f.GetPlatform(), state, recv, f.GetId(), extra)+ }+ return nil+}++func friendCommand(ctx context.Context, c pb.DaemonServiceClient, args []string) error {+ if len(args) == 0 {+ return errors.New("用法: friend code | friend add CODE [ADDRESS] | friend remove NAME | friend auto NAME on|off")+ }+ switch args[0] {+ case "code":+ return showFriendCode(ctx, c)+ case "add":+ if len(args) < 2 {+ return errors.New("用法: friend add CODE [ADDRESS]")+ }+ address := ""+ if len(args) > 2 {+ address = args[2]+ }+ req, err := c.RedeemFriendCode(ctx, &pb.RedeemPairingCodeRequest{Code: args[1], Address: address})+ if err != nil {+ return err+ }+ return confirmFriend(ctx, c, req)+ case "remove":+ f, err := findFriend(ctx, c, arg(args, 1))+ if err != nil {+ return err+ }+ _, err = c.RemoveFriend(ctx, &pb.FriendRef{DeviceId: f.GetId()})+ return err+ case "auto":+ f, err := findFriend(ctx, c, arg(args, 1))+ if err != nil {+ return err+ }+ _, err = c.SetFriendAutoAccept(ctx, &pb.SetFriendAutoAcceptRequest{DeviceId: f.GetId(), AutoAccept: arg(args, 2) == "on"})+ return err+ }+ return fmt.Errorf("未知的 friend 子命令 %q", args[0])+}++func arg(args []string, i int) string {+ if i < len(args) {+ return args[i]+ }+ return ""+}++// showFriendCode 显示好友码,等别人兑换后核对、确认+func showFriendCode(ctx context.Context, c pb.DaemonServiceClient) error {+ events, err := c.Subscribe(ctx, &pb.SubscribeRequest{})+ if err != nil {+ return err+ }+ resp, err := c.CreateFriendCode(ctx, &pb.Empty{})+ if err != nil {+ return err+ }+ fmt.Printf("好友码 %s (%s 前有效)\n", resp.GetCode(), time.Unix(resp.GetExpiresAtUnix(), 0).Format("15:04:05"))+ if len(resp.GetLanAddresses()) > 0 {+ fmt.Printf("本机地址 %s\n", strings.Join(resp.GetLanAddresses(), " "))+ }+ fmt.Println("等待对方输入…")+ for {+ ev, err := events.Recv()+ if err != nil {+ return err+ }+ if r := ev.GetFriendRequest(); r != nil {+ return confirmFriend(ctx, c, r)+ }+ }+}++func confirmFriend(ctx context.Context, c pb.DaemonServiceClient, r *pb.FriendRequest) error {+ events, err := c.Subscribe(ctx, &pb.SubscribeRequest{})+ if err != nil {+ return err+ }+ fmt.Printf("\n添加 %s · %s(%s)为好友?\n", r.GetDisplayName(), r.GetDeviceName(), r.GetPlatform())+ fmt.Printf(" 安全码 对方 %s\n 本机 %s\n", r.GetFingerprint(), r.GetSelfFingerprint())+ fmt.Print(" 添加?[y/N] ")+ line, _ := bufio.NewReader(os.Stdin).ReadString('\n')+ accept := strings.EqualFold(strings.TrimSpace(line), "y")+ if _, err := c.ConfirmFriend(ctx, &pb.ConfirmPairingRequest{PairingSession: r.GetSession(), Accept: accept}); err != nil {+ return err+ }+ if !accept {+ fmt.Println(" 已取消")+ return nil+ }+ fmt.Println(" 等待对方添加…")+ timeout := time.After(5 * time.Minute)+ got := make(chan error, 1)+ go func() {+ for {+ ev, err := events.Recv()+ if err != nil {+ got <- err+ return+ }+ if f := ev.GetFriendChanged(); f != nil && f.GetId() == r.GetDeviceId() {+ got <- nil+ return+ }+ if id := ev.GetFriendRemoved(); id == r.GetDeviceId() {+ got <- errors.New("对方取消了")+ return+ }+ }+ }()+ // 对方可能在本端确认之前已经添加了+ if list, err := c.ListFriends(ctx, &pb.Empty{}); err == nil {+ for _, f := range list.GetFriends() {+ if f.GetId() == r.GetDeviceId() {+ fmt.Println(" ✓ 已成为好友")+ return nil+ }+ }+ }+ select {+ case err := <-got:+ if err != nil {+ return err+ }+ fmt.Println(" ✓ 已成为好友")+ return nil+ case <-timeout:+ return errors.New("对方一直没有添加")+ }+}++func findFriend(ctx context.Context, c pb.DaemonServiceClient, name string) (*pb.Friend, error) {+ resp, err := c.ListFriends(ctx, &pb.Empty{})+ if err != nil {+ return nil, err+ }+ for _, f := range resp.GetFriends() {+ if f.GetId() == name || strings.EqualFold(f.GetDisplayName(), name) || strings.EqualFold(f.GetDeviceName(), name) {+ return f, nil+ }+ }+ return nil, fmt.Errorf("没有叫 %q 的好友", name)+}++// answerIncoming 接受或拒绝别人发来、在等本机用户接受的一批(ID 为空时取最近的一批)+func answerIncoming(ctx context.Context, c pb.DaemonServiceClient, id string, accept, always bool) error {+ if id == "" {+ resp, err := c.ListTransfers(ctx, &pb.ListTransfersRequest{Direction: pb.TransferDirection_TRANSFER_DIRECTION_INCOMING, Limit: 20})+ if err != nil {+ return err+ }+ for _, t := range resp.GetTransfers() {+ if t.GetStatus() == "asking" {+ id = t.GetId()+ break+ }+ }+ if id == "" {+ return errors.New("没有在等接受的文件")+ }+ }+ _, err := c.AnswerIncoming(ctx, &pb.AnswerIncomingRequest{TransferId: id, Accept: accept, Always: always})+ return err+}++func setName(ctx context.Context, c pb.DaemonServiceClient, name string) error {+ p, err := c.SetDisplayName(ctx, &pb.SetDisplayNameRequest{Name: name})+ if err != nil {+ return err+ }+ fmt.Println("显示为", p.GetDisplayName())+ return nil+}++func setAvatar(ctx context.Context, c pb.DaemonServiceClient, path string) error {+ var err error+ if path == "" || path == "reset" {+ _, err = c.ResetAvatar(ctx, &pb.Empty{})+ } else {+ _, err = c.SetAvatar(ctx, &pb.SetAvatarRequest{Path: path})+ }+ return err+}++// setReceiveFrom 改「允许这些人给我发文件」:off / friends / everyone+func setReceiveFrom(ctx context.Context, c pb.DaemonServiceClient, v string) error {+ cfg, err := c.GetConfig(ctx, &pb.Empty{})+ if err != nil {+ return err+ }+ if v == "" {+ fmt.Println(cfg.GetReceiveFrom())+ return nil+ }+ cfg.ReceiveFrom = v+ out, err := c.UpdateConfig(ctx, cfg)+ if err != nil {+ return err+ }+ fmt.Println(out.GetReceiveFrom())+ return nil+}diff --git a/client-core/cmd/pasteferry-cli/main.go b/client-core/cmd/pasteferry-cli/main.goindex 80a030f..682d12e 100644--- a/client-core/cmd/pasteferry-cli/main.go+++ b/client-core/cmd/pasteferry-cli/main.go@@ -46,7 +46,7 @@ func main() {cmd := flag.Arg(0)if cmd == "" {fmt.Fprintln(os.Stderr,- "用法: pasteferry-cli [-data-dir DIR] <status|watch|history|config|devices|nat|pair|join CODE [ADDRESS]|nearby [NAME]|address DEVICE ADDR|send [-relay] DEVICE PATH...|transfers [-v]|cancel ID>")+ "用法: pasteferry-cli [-data-dir DIR] <status|watch|history|config|devices|nat|pair|join CODE [ADDRESS]|nearby [NAME]|address DEVICE ADDR|send [-relay] [-note TEXT] DEVICE PATH...|transfers [-v]|cancel ID|friends|friend code|add|remove|auto|accept [ID] [always]|decline [ID]|name NAME|avatar PATH|reset|receive-from [off|friends|everyone]>")os.Exit(2)}@@ -108,6 +108,20 @@ func run(cmd, dataDir string) error {return showTransfers(ctx, client, flag.Arg(1) == "-v")case "cancel":return cancelTransfer(ctx, client, flag.Arg(1))+ case "friends":+ return showFriends(ctx, client)+ case "friend":+ return friendCommand(ctx, client, flag.Args()[1:])+ case "accept":+ return answerIncoming(ctx, client, flag.Arg(1), true, flag.Arg(2) == "always")+ case "decline":+ return answerIncoming(ctx, client, flag.Arg(1), false, false)+ case "name":+ return setName(ctx, client, flag.Arg(1))+ case "avatar":+ return setAvatar(ctx, client, flag.Arg(1))+ case "receive-from":+ return setReceiveFrom(ctx, client, flag.Arg(1))default:return fmt.Errorf("未知命令 %q", cmd)}diff --git a/client-core/cmd/pasteferry-cli/send.go b/client-core/cmd/pasteferry-cli/send.goindex 1f969bc..8007078 100644--- a/client-core/cmd/pasteferry-cli/send.go+++ b/client-core/cmd/pasteferry-cli/send.go@@ -18,16 +18,23 @@ import (// 要经官方服务中转时,带上 -relay 才发。func sendFiles(ctx context.Context, c pb.DaemonServiceClient, args []string) error {allowRelay := false+ note := ""var rest []string- for _, a := range args {+ for i := 0; i < len(args); i++ {+ a := args[i]if a == "-relay" || a == "--relay" {allowRelay = truecontinue}+ if (a == "-note" || a == "--note") && i+1 < len(args) {+ note = args[i+1]+ i+++ continue+ }rest = append(rest, a)}if len(rest) < 2 {- return errors.New("用法: send [-relay] DEVICE PATH...")+ return errors.New("用法: send [-relay] [-note TEXT] DEVICE PATH...")}devices, err := c.ListDevices(ctx, &pb.Empty{})if err != nil {@@ -40,7 +47,15 @@ func sendFiles(ctx context.Context, c pb.DaemonServiceClient, args []string) err}}if target == nil {- return fmt.Errorf("没有叫 %q 的已配对设备", rest[0])+ // 好友,或者「所有人」模式下附近的陌生设备(lan:实例名)+ if f, ferr := findFriend(ctx, c, rest[0]); ferr == nil {+ target = &pb.Device{Id: f.GetId(), Name: f.GetDisplayName() + " · " + f.GetDeviceName()}+ } else if strings.HasPrefix(rest[0], "lan:") {+ target = &pb.Device{Id: rest[0], Name: rest[0]}+ }+ }+ if target == nil {+ return fmt.Errorf("没有叫 %q 的已配对设备或好友", rest[0])}var paths []stringfor _, p := range rest[1:] {@@ -55,7 +70,7 @@ func sendFiles(ctx context.Context, c pb.DaemonServiceClient, args []string) errif err != nil {return err}- t, err := c.SendFiles(ctx, &pb.SendFilesRequest{DeviceId: target.GetId(), Paths: paths, AllowRelay: allowRelay})+ t, err := c.SendFiles(ctx, &pb.SendFilesRequest{DeviceId: target.GetId(), Paths: paths, AllowRelay: allowRelay, Note: note})if err != nil {if s, ok := status.FromError(err); ok && s.Code() == codes.FailedPrecondition && s.Message() == "relay" {return errors.New("要经服务中转(有每日额度),确认要发的话加上 -relay")@@ -98,6 +113,10 @@ func transferLine(t *pb.Transfer) string {switch t.GetStatus() {case "scanning":return fmt.Sprintf("统计中… %d 个文件", t.GetScannedFiles())+ case "asking":+ return "等待对方接受…"+ case "declined":+ return "declined " + t.GetError()case "active":pct := 0.0if t.GetTotalBytes() > 0 {@@ -140,6 +159,9 @@ func showTransfers(ctx context.Context, c pb.DaemonServiceClient, verbose bool)}fmt.Printf("%s %s%s %s %s %s %s %s\n", dir, id, when, who, t.GetDeviceName(),strings.Join(names, ", "), humanBytes(t.GetTotalBytes()), state)+ if t.GetNote() != "" {+ fmt.Printf(" 备注:%s\n", t.GetNote())+ }for _, p := range t.GetPaths() {if t.GetDirection() == pb.TransferDirection_TRANSFER_DIRECTION_INCOMING {fmt.Printf(" %s\n", p)diff --git a/client-core/cmd/pasteferryd/friends.go b/client-core/cmd/pasteferryd/friends.gonew file mode 100644index 0000000..ce9fc93--- /dev/null+++ b/client-core/cmd/pasteferryd/friends.go@@ -0,0 +1,179 @@+package main++import (+ "context"+ "strings"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/peers"+ "github.com/baiyuze/pasteferry/client-core/internal/profile"+ "github.com/baiyuze/pasteferry/client-core/internal/rpc"+ "github.com/baiyuze/pasteferry/client-core/internal/send"+ "github.com/baiyuze/pasteferry/client-core/internal/store"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// friendsAPI 把好友(peers.Manager)与本机名片、头像(profile.Profile)拼成界面用的接口,见 rpc.Friends。+type friendsAPI struct {+ peers *peers.Manager+ profile *profile.Profile+ db *store.Store+ deviceID string+ // changed 在名字或头像变了以后调用:推给界面、告诉连着的好友+ changed func()+}++func (f *friendsAPI) Profile() *pb.Profile { return f.profile.Proto(f.deviceID) }++func (f *friendsAPI) SetDisplayName(name string) (*pb.Profile, error) {+ if err := f.profile.SetDisplayName(name); err != nil {+ return nil, err+ }+ f.changed()+ return f.Profile(), nil+}++func (f *friendsAPI) SetAvatar(req *pb.SetAvatarRequest) (*pb.Profile, error) {+ if err := f.profile.SetAvatar(req.GetImage(), req.GetPath(), req.GetCropX(), req.GetCropY(), req.GetCropSize()); err != nil {+ return nil, err+ }+ f.changed()+ return f.Profile(), nil+}++func (f *friendsAPI) ResetAvatar() (*pb.Profile, error) {+ if err := f.profile.ResetAvatar(); err != nil {+ return nil, err+ }+ f.changed()+ return f.Profile(), nil+}++func (f *friendsAPI) Avatar(deviceID string) *pb.Avatar {+ if deviceID == "" || deviceID == f.deviceID {+ data := f.profile.Avatar()+ return &pb.Avatar{Jpeg: data, AvatarHash: peers.AvatarHash(data)}+ }+ c, ok := f.peers.FriendContact(deviceID)+ if !ok {+ return &pb.Avatar{}+ }+ return &pb.Avatar{Jpeg: f.profile.FriendAvatar(c.AvatarPath), AvatarHash: c.AvatarHash}+}++func (f *friendsAPI) CreateFriendCode(ctx context.Context) (string, time.Time, []string, error) {+ return f.peers.CreateFriendCode(ctx)+}++func (f *friendsAPI) RedeemFriendCode(ctx context.Context, code, address string) (*pb.FriendRequest, error) {+ return f.peers.RedeemFriendCode(ctx, code, address)+}++func (f *friendsAPI) ConfirmFriend(ctx context.Context, session string, accept bool) error {+ return f.peers.ConfirmFriend(ctx, session, accept)+}++func (f *friendsAPI) Friends() []*pb.Friend { return f.peers.Friends() }++func (f *friendsAPI) RemoveFriend(ctx context.Context, id string) error {+ return f.peers.RemoveFriend(ctx, id)+}++func (f *friendsAPI) SetFriendAutoAccept(id string, auto bool) (*pb.Friend, error) {+ return f.peers.SetFriendAutoAccept(id, auto)+}++func (f *friendsAPI) BlockDevice(id string) error { return f.peers.BlockDevice(id) }++func (f *friendsAPI) WatchStrangers(ctx context.Context, send func(*pb.Strangers) error) error {+ return f.peers.WatchStrangers(ctx, send)+}++var _ rpc.Friends = (*friendsAPI)(nil)++// transfersAPI 是隔空传送的界面接口:发给「所有人」模式下的陌生设备(lan:实例名)时,+// 先向它要公钥,换成设备 ID+type transfersAPI struct {+ *send.Engine+ peers *peers.Manager+}++func (t transfersAPI) SendFiles(deviceID string, paths []string, allowRelay bool, note string) (*pb.Transfer, error) {+ if strings.HasPrefix(deviceID, peers.StrangerPrefix) {+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)+ defer cancel()+ id, err := t.peers.ResolveStranger(ctx, deviceID)+ if err != nil {+ return nil, send.ErrOffline+ }+ // 连上并收到对方的功能声明后才知道它能不能收+ deadline := time.Now().Add(8 * time.Second)+ for time.Now().Before(deadline) && !t.peers.HasFeature(id, peers.FeatureSendAsk) {+ time.Sleep(200 * time.Millisecond)+ }+ deviceID = id+ }+ return t.Engine.SendFiles(deviceID, paths, allowRelay, note)+}++// sendPeer 是隔空传送看到的某台电脑:自己的设备或好友、陌生设备。+func sendPeer(peerMgr *peers.Manager, deviceID string) send.Peer {+ state := peerMgr.ConnState(deviceID)+ connected := state.Proto() == pb.ConnectionKind_CONNECTION_KIND_DIRECT || state.Proto() == pb.ConnectionKind_CONNECTION_KIND_RELAY+ relayed := state.Proto() == pb.ConnectionKind_CONNECTION_KIND_RELAY+ switch peerMgr.Role(deviceID) {+ case peers.RoleSelf:+ _, list := peerMgr.Devices()+ for _, d := range list {+ if d.GetId() == deviceID {+ return send.Peer{+ Known: true, Name: d.GetName(), Online: d.GetOnline(), Role: peers.RoleSelf,+ Connected: connected, Relayed: relayed,+ Supported: d.GetReceivesFiles(), Disabled: d.GetReceiveDisabled(),+ Ask: peerMgr.HasFeature(deviceID, peers.FeatureSendAsk),+ }+ }+ }+ case peers.RoleFriend:+ if fr, ok := peerMgr.Friend(deviceID); ok {+ name := fr.GetDisplayName()+ if fr.GetDeviceName() != "" {+ name += " · " + fr.GetDeviceName()+ }+ return send.Peer{+ Known: true, Name: name, Online: fr.GetOnline(), Role: peers.RoleFriend,+ Connected: connected, Relayed: relayed,+ Supported: fr.GetReceivesFiles() || fr.GetReceiveDisabled(), Disabled: fr.GetReceiveDisabled(),+ Ask: peerMgr.HasFeature(deviceID, peers.FeatureSendAsk),+ }+ }+ case peers.RoleStranger:+ if st, ok := peerMgr.Stranger(deviceID); ok {+ return send.Peer{+ Known: true, Name: st.GetDisplayName(), Online: true, Role: peers.RoleStranger,+ Connected: connected, Relayed: relayed,+ Supported: peerMgr.HasFeature(deviceID, peers.FeatureSendFiles) || peerMgr.HasFeature(deviceID, peers.FeatureSendFilesOff),+ Disabled: peerMgr.HasFeature(deviceID, peers.FeatureSendFilesOff),+ Ask: peerMgr.HasFeature(deviceID, peers.FeatureSendAsk),+ }+ }+ }+ return send.Peer{}+}++// admit 决定收不收某台电脑发来的文件:自己的设备看「接收文件」开关,别人看「允许这些人给我发文件」,+// 被屏蔽的陌生设备一律不收;打开了自动接收的好友不用问+func admit(peerMgr *peers.Manager, db *store.Store, deviceID string) send.Admission {+ role := peerMgr.Role(deviceID)+ if role == peers.RoleSelf {+ return send.Admission{Allowed: peerMgr.ReceivesFrom(deviceID), AutoAccept: true}+ }+ if db.IsBlocked(deviceID) {+ return send.Admission{}+ }+ a := send.Admission{Allowed: peerMgr.ReceivesFrom(deviceID)}+ if c, ok := peerMgr.FriendContact(deviceID); ok && role == peers.RoleFriend {+ a.AutoAccept = c.AutoAccept+ }+ return a+}diff --git a/client-core/cmd/pasteferryd/main.go b/client-core/cmd/pasteferryd/main.goindex a662e73..47618ac 100644--- a/client-core/cmd/pasteferryd/main.go+++ b/client-core/cmd/pasteferryd/main.go@@ -28,6 +28,7 @@ import ("github.com/baiyuze/pasteferry/client-core/internal/notifications""github.com/baiyuze/pasteferry/client-core/internal/peers""github.com/baiyuze/pasteferry/client-core/internal/power"+ "github.com/baiyuze/pasteferry/client-core/internal/profile""github.com/baiyuze/pasteferry/client-core/internal/rpc""github.com/baiyuze/pasteferry/client-core/internal/send""github.com/baiyuze/pasteferry/client-core/internal/store"@@ -270,9 +271,19 @@ func run(dataDir string) error {hub.Navigate(page)return notifications.OpenUI()},+ Accept: func(id string) error {+ if sender == nil {+ return nil+ }+ _, _, err := sender.Answer(id, true)+ return err+ },})defer notifier.Close()+ // 好友看到的名字和头像,好友发来的头像、收到的图片的缩略图+ prof := profile.New(paths.Root, loadCfg, saveCfg)+// 状态快照要由 gRPC 服务组装,而它晚于 peerMgr 创建,这里先记下"状态变了",// 等服务就绪后统一推送。容量 1 让连续的变化合并成一次刷新。statusDirty := make(chan struct{}, 1)@@ -292,6 +303,28 @@ func run(dataDir string) error {OnDeviceChanged: func(d *pb.Device) {hub.Publish(rpc.EventDeviceChanged(d))},+ // 好友(2.6.0)+ Card: prof.Card,+ Avatar: prof.Avatar,+ SaveAvatar: prof.SaveFriendAvatar,+ OnFriendChanged: func(f *pb.Friend) {+ hub.Publish(rpc.EventFriendChanged(f))+ },+ OnFriendRemoved: func(id string) {+ hub.Publish(rpc.EventFriendRemoved(id))+ },+ OnFriendRequest: func(r *pb.FriendRequest) {+ hub.Publish(rpc.EventFriendRequest(r))+ },+ OnOtherReady: func(deviceID string) {+ if sender != nil {+ go sender.PeerReady(deviceID)+ }+ },+ ShareableStream: send.IsStream,+ InUse: func(deviceID string) bool {+ return sender != nil && sender.Busy(deviceID)+ },OnStatusChanged: func() {select {case statusDirty <- struct{}{}:@@ -394,22 +427,13 @@ func run(dataDir string) error {OpenStream: peerMgr.P2P().OpenStream,ListenLAN: listenLAN,DialLAN: dialLAN,- Peer: func(deviceID string) send.Peer {- _, list := peerMgr.Devices()- for _, d := range list {- if d.GetId() != deviceID {- continue- }- state := peerMgr.ConnState(deviceID)- return send.Peer{- Known: true, Name: d.GetName(), Online: d.GetOnline(),- Connected: state == p2p.StateDirect || state == p2p.StateRelay,- Relayed: state == p2p.StateRelay,- Supported: d.GetReceivesFiles(), Disabled: d.GetReceiveDisabled(),- }- }- return send.Peer{}+ Peer: func(deviceID string) send.Peer { return sendPeer(peerMgr, deviceID) },+ Admit: func(deviceID string) send.Admission { return admit(peerMgr, db, deviceID) },+ Connect: func(deviceID string) {+ peerMgr.ConnectFriend(deviceID)},+ Thumbnail: prof.Thumbnail,+ Delivered: peerMgr.TouchFriend,RelayQuotaExhausted: func() bool {u := peerMgr.OfficialUsage()return u != nil && (u.GetReason() == "quota_exhausted" || u.GetReason() == "global_exhausted" ||@@ -423,10 +447,12 @@ func run(dataDir string) error {hub.Publish(rpc.EventTransferRemoved(id))},OnNotice: func(kind send.NoticeKind, t *pb.Transfer) {- if loadCfg().ReceiveNotifyDisabled {+ // 别人发来、等用户接受的一定要通知:界面可能没开+ if loadCfg().ReceiveNotifyDisabled && kind != send.NoticeAsk {return}- name := map[send.NoticeKind]string{send.NoticeIncoming: "incoming", send.NoticeReceived: "received", send.NoticeFailed: "failed"}[kind]+ name := map[send.NoticeKind]string{send.NoticeIncoming: "incoming", send.NoticeReceived: "received",+ send.NoticeFailed: "failed", send.NoticeAsk: "ask", send.NoticeIgnored: "ignored"}[kind]notifier.Transfer(name, t, receivedFolder(t))},})@@ -469,10 +495,19 @@ func run(dataDir string) error {if c.LANDisabled != prev.LANDisabled {peerMgr.SetLANEnabled(!c.LANDisabled)}- // 关掉或打开接收文件后,让对方的雷达立即更新- if c.ReceiveDisabled != prev.ReceiveDisabled {+ // 关掉或打开接收文件、改了谁可以给我发文件后,让对方的雷达立即更新+ if c.ReceiveFrom != prev.ReceiveFrom || c.EveryoneUntil != prev.EveryoneUntil {+ peerMgr.ApplyEveryone()+ }+ if c.ReceiveDisabled != prev.ReceiveDisabled || c.ReceiveFrom != prev.ReceiveFrom || c.EveryoneUntil != prev.EveryoneUntil {peerMgr.BroadcastFeatures()}+ // 好友看到的名片变了+ if c.DisplayName != prev.DisplayName || c.DeviceName != prev.DeviceName ||+ c.EffectiveSignalingURL() != prev.EffectiveSignalingURL() || c.ServiceMode != prev.ServiceMode {+ peerMgr.BroadcastCard()+ hub.Publish(rpc.EventProfileChanged(prof.Proto(id.DeviceID)))+ }if c.EffectiveSignalingURL() != prev.EffectiveSignalingURL() || c.ServiceMode != prev.ServiceMode || c.LANDisabled != prev.LANDisabled ||c.UpdateCheckDisabled != prev.UpdateCheckDisabled || c.UpdateSkipVersion != prev.UpdateSkipVersion {select {@@ -486,6 +521,31 @@ func run(dataDir string) error {return nil}+ // 「所有人」到时间自动回到「仅限好友」;顺便清理过期的缩略图+ go func() {+ t := time.NewTicker(15 * time.Second)+ defer t.Stop()+ lastClean := time.Time{}+ for {+ select {+ case <-ctx.Done():+ return+ case now := <-t.C:+ c := loadCfg()+ if c.ReceiveFrom == config.ReceiveFromEveryone && c.EveryoneUntil > 0 && c.EveryoneUntil <= now.Unix() {+ c.ReceiveFrom, c.EveryoneUntil = config.ReceiveFromFriends, 0+ if err := saveCfgAndApply(c); err != nil {+ slog.Warn("「所有人」到时间了,但没能改回「仅限好友」", "err", err)+ }+ }+ if now.Sub(lastClean) > 6*time.Hour {+ lastClean = now+ prof.CleanThumbs()+ }+ }+ }+ }()+// ── gRPC 服务 ──token, err := rpc.NewToken()if err != nil {@@ -560,7 +620,12 @@ func run(dataDir string) error {NotificationStatus: notifier.Status,RequestNotifications: notifier.Request,ActivateNotification: notifier.Activate,- Transfers: sender,+ Transfers: transfersAPI{Engine: sender, peers: peerMgr},+ Friends: &friendsAPI{peers: peerMgr, profile: prof, db: db, deviceID: id.DeviceID, changed: func() {+ peerMgr.BroadcastCard()+ peerMgr.ApplyEveryone()+ hub.Publish(rpc.EventProfileChanged(prof.Proto(id.DeviceID)))+ }},}wireUpdater(&deps, updater)srv := rpc.NewServer(deps, hub, token)diff --git a/client-core/internal/config/config.go b/client-core/internal/config/config.goindex f2d85ce..ba5e42b 100644--- a/client-core/internal/config/config.go+++ b/client-core/internal/config/config.go@@ -80,6 +80,37 @@ type Config struct {ReceiveNotifyDisabled bool `json:"receive_notify_disabled,omitempty"`// SendLayoutStacked 让隔空传送页上下排:传输列表放在雷达下面。默认左右排,只有界面用SendLayoutStacked bool `json:"send_layout_stacked,omitempty"`++ // ReceiveFrom 是谁可以给我发文件(只管别人,自己的设备看 ReceiveDisabled),见 design/friends-send.md:+ // "off"(均不允许)、"friends"(仅限好友)、"everyone"(所有人,只在局域网)。空字符串表示默认的仅限好友+ ReceiveFrom string `json:"receive_from,omitempty"`+ // EveryoneUntil 是「所有人」自动回到「仅限好友」的时间(Unix 秒),打开「所有人」时设为 10 分钟后+ EveryoneUntil int64 `json:"everyone_until,omitempty"`+ // DisplayName 是好友看到的名字,空字符串表示系统的用户全名+ DisplayName string `json:"display_name,omitempty"`+}++// 谁可以给我发文件+const (+ ReceiveFromOff = "off"+ ReceiveFromFriends = "friends"+ ReceiveFromEveryone = "everyone"+)++// EveryoneWindow 是「所有人」打开多久后自动关掉+const EveryoneWindow = 10 * time.Minute++// EffectiveReceiveFrom 返回此刻实际的接收范围:「所有人」过了时间就算「仅限好友」。+func (c Config) EffectiveReceiveFrom(now time.Time) string {+ switch c.ReceiveFrom {+ case ReceiveFromOff:+ return ReceiveFromOff+ case ReceiveFromEveryone:+ if c.EveryoneUntil > now.Unix() {+ return ReceiveFromEveryone+ }+ }+ return ReceiveFromFriends}// EffectiveReceiveDir 返回隔空传送实际的保存位置。@@ -178,6 +209,17 @@ func (c *Config) Validate() {}// 写不对的快捷键当作默认的c.QuickPasteHotkey = NormalizeHotkey(c.QuickPasteHotkey)+ switch c.ReceiveFrom {+ case ReceiveFromOff, ReceiveFromFriends, ReceiveFromEveryone:+ default:+ c.ReceiveFrom = ""+ }+ if c.ReceiveFrom != ReceiveFromEveryone {+ c.EveryoneUntil = 0+ }+ if len(c.DisplayName) > 64 {+ c.DisplayName = c.DisplayName[:64]+ }}// ─────────────────────────── 目录布局 ───────────────────────────diff --git a/client-core/internal/notifications/catalog.json b/client-core/internal/notifications/catalog.jsonindex 0a823a7..adbed83 100644--- a/client-core/internal/notifications/catalog.json+++ b/client-core/internal/notifications/catalog.json@@ -36,7 +36,16 @@"transferError_source_changed": "A file was changed on the sending computer while it was being sent.","transferError_source_missing": "A file was removed from the sending computer.","transferError_read_error": "The sending computer could not read a file.",- "transferErrorOther": "The transfer stopped."+ "transferErrorOther": "The transfer stopped.",+ "transferAskTitle": "{device} wants to send you files",+ "transferAskBody": "{name} · {size}{note}",+ "transferIgnoredTitle": "Ignored files from {device}",+ "transferIgnoredBody": "{name}",+ "transferNote": "Note: ",+ "acceptFiles": "Accept",+ "transferError_declined": "Declined.",+ "transferError_timeout": "No response.",+ "transferError_not_allowed": "The receiver doesn't accept files."},"zh-Hans": {"notifyPendingTitle": "接收后即可粘贴",@@ -75,7 +84,16 @@"transferError_source_changed": "发送过程中,对方电脑上的文件被修改了。","transferError_source_missing": "对方电脑上的文件已经不在了。","transferError_read_error": "对方电脑读取文件失败。",- "transferErrorOther": "传输中断了。"+ "transferErrorOther": "传输中断了。",+ "transferAskTitle": "{device} 想发给你文件",+ "transferAskBody": "{name} · {size}{note}",+ "transferIgnoredTitle": "已忽略 {device} 发来的文件",+ "transferIgnoredBody": "{name}",+ "transferNote": "备注:",+ "acceptFiles": "接受",+ "transferError_declined": "已拒绝。",+ "transferError_timeout": "没有回应。",+ "transferError_not_allowed": "对方不接收文件。"},"ja": {"notifyPendingTitle": "受信するとペーストできます",@@ -114,7 +132,16 @@"transferError_source_changed": "送信中に相手のコンピュータでファイルが変更されました。","transferError_source_missing": "相手のコンピュータからファイルがなくなりました。","transferError_read_error": "相手のコンピュータでファイルを読み取れませんでした。",- "transferErrorOther": "転送が中断しました。"+ "transferErrorOther": "転送が中断しました。",+ "transferAskTitle": "{device} からファイルが届いています",+ "transferAskBody": "{name} · {size}{note}",+ "transferIgnoredTitle": "{device} からのファイルを無視しました",+ "transferIgnoredBody": "{name}",+ "transferNote": "メモ:",+ "acceptFiles": "受け入れる",+ "transferError_declined": "拒否されました。",+ "transferError_timeout": "応答がありませんでした。",+ "transferError_not_allowed": "相手はファイルを受け付けていません。"},"zh-Hant-TW": {"notifyPendingTitle": "接收後即可貼上",@@ -153,7 +180,16 @@"transferError_source_changed": "傳送過程中,對方電腦上的檔案被修改了。","transferError_source_missing": "對方電腦上的檔案已經不在了。","transferError_read_error": "對方電腦讀取檔案失敗。",- "transferErrorOther": "傳輸中斷了。"+ "transferErrorOther": "傳輸中斷了。",+ "transferAskTitle": "{device} 想傳檔案給你",+ "transferAskBody": "{name} · {size}{note}",+ "transferIgnoredTitle": "已忽略 {device} 傳來的檔案",+ "transferIgnoredBody": "{name}",+ "transferNote": "備註:",+ "acceptFiles": "接受",+ "transferError_declined": "已拒絕。",+ "transferError_timeout": "沒有回應。",+ "transferError_not_allowed": "對方不接收檔案。"},"zh-Hant-HK": {"notifyPendingTitle": "接收後即可貼上",@@ -192,6 +228,15 @@"transferError_source_changed": "傳送期間,對方電腦上的檔案被修改了。","transferError_source_missing": "對方電腦上的檔案已經不在了。","transferError_read_error": "對方電腦讀取檔案失敗。",- "transferErrorOther": "傳輸中斷了。"+ "transferErrorOther": "傳輸中斷了。",+ "transferAskTitle": "{device} 想傳檔案給你",+ "transferAskBody": "{name} · {size}{note}",+ "transferIgnoredTitle": "已忽略 {device} 傳來的檔案",+ "transferIgnoredBody": "{name}",+ "transferNote": "備註:",+ "acceptFiles": "接受",+ "transferError_declined": "已拒絕。",+ "transferError_timeout": "沒有回應。",+ "transferError_not_allowed": "對方不接收檔案。"}}diff --git a/client-core/internal/notifications/notifications.go b/client-core/internal/notifications/notifications.goindex eb5f82c..b13f713 100644--- a/client-core/internal/notifications/notifications.go+++ b/client-core/internal/notifications/notifications.go@@ -41,6 +41,8 @@ type Options struct {// OpenPage 打开主窗口并切到某一页("send")Reveal func(transferID string) errorOpenPage func(page string) error+ // Accept 是好友、陌生设备发来文件时通知上的「接受」(2.6.0)+ Accept func(transferID string) error}type Manager struct {@@ -189,8 +191,12 @@ func (m *Manager) Transfer(kind string, t *pb.Transfer, folder string) {if errText == "" {errText = translate(lang, "transferErrorOther")}+ note := ""+ if n := t.GetNote(); n != "" {+ note = "\n" + translate(lang, "transferNote") + n+ }replace := strings.NewReplacer("{name}", name, "{device}", t.GetDeviceName(),- "{size}", humanSize(t.GetTotalBytes()), "{folder}", folder, "{error}", errText)+ "{size}", humanSize(t.GetTotalBytes()), "{folder}", folder, "{error}", errText, "{note}", note)reveal := map[string]string{"darwin": "showInFinder", "windows": "showInFolder"}[runtime.GOOS]if reveal == "" {reveal = "openFolder"@@ -199,6 +205,11 @@ func (m *Manager) Transfer(kind string, t *pb.Transfer, folder string) {switch kind {case "incoming":title, body, action, label = "transferIncomingTitle", "transferIncomingBody", "open", "viewProgress"+ case "ask":+ // 点通知本身打开隔空传送页,界面里有「接受」「拒绝」+ title, body, action, label = "transferAskTitle", "transferAskBody", "accept", "acceptFiles"+ case "ignored":+ title, body, action, label = "transferIgnoredTitle", "transferIgnoredBody", "open", "viewProgress"case "received":title, body, action, label = "transferReceivedTitle", "transferReceivedBody", "reveal", revealdefault:@@ -221,6 +232,9 @@ func (m *Manager) Activate(ctx context.Context, id, action string) error {if action == "reveal" && m.opts.Reveal != nil {return m.opts.Reveal(transferID)}+ if action == "accept" && m.opts.Accept != nil {+ return m.opts.Accept(transferID)+ }if m.opts.OpenPage != nil {return m.opts.OpenPage("send")}diff --git a/client-core/internal/peers/friends.go b/client-core/internal/peers/friends.gonew file mode 100644index 0000000..173452a--- /dev/null+++ b/client-core/internal/peers/friends.go@@ -0,0 +1,1047 @@+package peers++// 好友:别人的一台电脑,只能互相发文件,见 design/friends-send.md。+//+// 好友与配对设备分开存(store 的 contacts 表),连接按角色区分:+// - self:自己配对的设备,什么都能收发(剪贴板同步、隔空传送);+// - friend:好友,只放行隔空传送、名片、头像和功能声明;+// - stranger:「所有人」模式下局域网里的陌生设备,只放行隔空传送和功能声明。+// 白名单在 allowFromOther,以后新加的消息默认不放行。+//+// 加好友复用配对码的通道:好友码就是 F 加一个配对码。两边在交换公钥时说明这次的用途+// (局域网里放在 LanPairInfo.intent,经服务器时用签名的 PairIntent 信令),用途不一致就回绝,+// 免得把好友码当成配对码输进「添加设备」,把别人加成了自己的设备。++import (+ "bytes"+ "context"+ "crypto/sha256"+ "errors"+ "fmt"+ "net/netip"+ "runtime"+ "slices"+ "strings"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/store"+ "github.com/baiyuze/pasteferry/client-core/internal/transport/lan"+ "github.com/baiyuze/pasteferry/client-core/internal/transport/p2p"+ "github.com/baiyuze/pasteferry/proto/deviceid"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+ "github.com/baiyuze/pasteferry/proto/pairingcode"+)++// 连接的角色,与 store.RoleSelf 等相同+const (+ RoleSelf = store.RoleSelf+ RoleFriend = store.RoleFriend+ RoleStranger = store.RoleStranger+)++// 好友相关的功能标记(2.6.0)+const (+ FeatureFriends = "friends_v1"+ // 发来的文件可以等接收方的用户点「接受」(SendAnswer.reason = pending),带备注。+ // 给好友、陌生设备发文件要求对方声明它:旧版本收到发送请求会直接接收,绕过确认+ FeatureSendAsk = "send_files_ask_v1"+)++var (+ // ErrIsFriendCode:在「添加设备」里输入了好友码+ ErrIsFriendCode = errors.New("这是好友码,请在「添加好友」里输入")+ // ErrIsDeviceCode:在「添加好友」里输入了配对码+ ErrIsDeviceCode = errors.New("这是配对码,请在「添加设备」里输入")+ // ErrPeerOutdated:对方的版本不认识好友码+ ErrPeerOutdated = errors.New("对方需要更新到 2.6.0 或更高")+ // ErrAlreadyPaired:这台电脑已经是自己配对的设备+ ErrAlreadyPaired = errors.New("这台电脑已经是你的设备")+ ErrNotFriend = errors.New("没有这个好友")+ // ErrFriendDeclined:对方在确认框里点了取消+ ErrFriendDeclined = errors.New("对方取消了")+)++const (+ // friendIdle 是好友的连接空闲多久后断开+ friendIdle = 2 * time.Minute+ // intentWait 是经服务器兑换好友码后,等对方说明用途的时间+ intentWait = 12 * time.Second+ // intentConfirmWait 是确认配对时最多再等对方说明用途多久+ intentConfirmWait = 5 * time.Second+ // noticeKeep 是删除好友的通知最多补发多久+ noticeKeep = 30 * 24 * time.Hour+ // 头像最大多大(JPEG)+ maxAvatarBytes = 64 << 10+)++// ─────────────────────── 角色 ───────────────────────++// Role 返回与某台电脑的关系:RoleSelf、RoleFriend、RoleStranger,都不是时为空。+func (m *Manager) Role(deviceID string) string {+ m.mu.RLock()+ defer m.mu.RUnlock()+ return m.roleLocked(deviceID)+}++func (m *Manager) roleLocked(id string) string {+ if _, ok := m.known[id]; ok {+ return RoleSelf+ }+ if _, ok := m.contacts[id]; ok {+ return RoleFriend+ }+ if _, ok := m.strangers[id]; ok {+ return RoleStranger+ }+ return ""+}++// allowFromOther 是好友和陌生设备发来的 P2P 消息里可以交给上层的那些:隔空传送的控制消息。+// 功能声明、名片、头像在本包里处理。其余(剪贴板同步等)一律不收+func allowFromOther(msg *pb.PeerMessage) bool {+ switch msg.GetPayload().(type) {+ case *pb.PeerMessage_SendOffer, *pb.PeerMessage_SendAnswer, *pb.PeerMessage_SendCancel, *pb.PeerMessage_SendResult:+ return true+ }+ return false+}++// handleOtherMessage 处理好友与陌生设备的 P2P 消息,返回 true 表示已处理或丢弃,不再交给上层。+func (m *Manager) handleOtherMessage(id, role string, msg *pb.PeerMessage) bool {+ m.touch(id)+ switch p := msg.GetPayload().(type) {+ case *pb.PeerMessage_Features:+ m.updatePeerFeatures(id, p.Features)+ return true+ case *pb.PeerMessage_FriendCard:+ if role == RoleFriend {+ m.updateFriendCard(id, p.FriendCard)+ }+ return true+ case *pb.PeerMessage_AvatarRequest:+ if role == RoleFriend {+ m.sendAvatar(id, p.AvatarRequest.GetAvatarHash())+ }+ return true+ case *pb.PeerMessage_AvatarData:+ if role == RoleFriend {+ m.receiveAvatar(id, p.AvatarData)+ }+ return true+ }+ if !allowFromOther(msg) {+ m.log.Warn("丢弃非自己设备发来的消息", "device", id, "role", role, "type", fmt.Sprintf("%T", msg.GetPayload()))+ return true+ }+ return false+}++func (m *Manager) touch(id string) {+ m.mu.Lock()+ m.lastUse[id] = time.Now()+ m.mu.Unlock()+}++// otherIDs 返回好友、待补发删除通知的、正在配对的和陌生设备:局域网通道也要去找它们。+func (m *Manager) lanPeerIDs() []string {+ m.mu.RLock()+ defer m.mu.RUnlock()+ ids := make([]string, 0, len(m.known)+len(m.contacts))+ for id := range m.known {+ ids = append(ids, id)+ }+ for id := range m.contacts {+ ids = append(ids, id)+ }+ for id := range m.notices {+ ids = append(ids, id)+ }+ for _, p := range m.pending {+ ids = append(ids, p.peer.ID)+ }+ for id := range m.strangers {+ ids = append(ids, id)+ }+ return ids+}++// watchIDs 是请服务器推送在线状态的设备:配对设备、好友、待补发删除通知的+func (m *Manager) watchIDsLocked() []string {+ ids := make([]string, 0, len(m.known)+len(m.contacts))+ for id := range m.known {+ ids = append(ids, id)+ }+ for id := range m.contacts {+ ids = append(ids, id)+ }+ for id := range m.notices {+ ids = append(ids, id)+ }+ return ids+}++// ─────────────────────── 功能声明 ───────────────────────++// featuresFor 是发给某个角色的功能声明。自己的设备看「接收文件」开关,别人看「允许这些人给我发文件」+func (m *Manager) featuresFor(role string) *pb.PeerMessage {+ cfg := m.loadConfig()+ var f []string+ switch role {+ case RoleSelf:+ f = []string{FeatureSendFiles}+ if cfg.ReceiveDisabled {+ f = []string{FeatureSendFilesOff}+ }+ default:+ if receivesFrom(cfg, role, time.Now()) {+ f = []string{FeatureSendFiles}+ } else {+ f = []string{FeatureSendFilesOff}+ }+ }+ f = append(f, FeatureSendFilesTCP, FeatureFriends, FeatureSendAsk)+ return &pb.PeerMessage{Payload: &pb.PeerMessage_Features{Features: &pb.PeerFeatures{Features: f, AppVersion: m.appVersion}}}+}++// receivesFrom 报告此刻是否接收某个角色发来的文件。+func receivesFrom(cfg config.Config, role string, now time.Time) bool {+ switch cfg.EffectiveReceiveFrom(now) {+ case config.ReceiveFromEveryone:+ return role == RoleFriend || role == RoleStranger+ case config.ReceiveFromFriends:+ return role == RoleFriend+ }+ return false+}++// ReceivesFrom 报告本机此刻是否接收这台电脑发来的文件(按它的角色和设置)。自己的设备看「接收文件」开关+func (m *Manager) ReceivesFrom(deviceID string) bool {+ role := m.Role(deviceID)+ if role == RoleSelf {+ return !m.loadConfig().ReceiveDisabled+ }+ return receivesFrom(m.loadConfig(), role, time.Now())+}++// ─────────────────────── 名片与头像 ───────────────────────++func (m *Manager) selfCard() *pb.FriendCard {+ if m.card != nil {+ return m.card()+ }+ cfg := m.loadConfig()+ return &pb.FriendCard{DisplayName: cfg.DisplayName, DeviceName: cfg.DeviceName, Platform: runtime.GOOS}+}++// ServiceHash 是自建服务器地址的哈希,好友据此判断两边是不是同一台服务器+func ServiceHash(url string) []byte {+ if url == "" {+ return nil+ }+ sum := sha256.Sum256([]byte(strings.TrimRight(strings.ToLower(strings.TrimSpace(url)), "/")))+ return sum[:16]+}++// AvatarHash 是头像(JPEG)的哈希+func AvatarHash(jpeg []byte) []byte {+ if len(jpeg) == 0 {+ return nil+ }+ sum := sha256.Sum256(jpeg)+ return sum[:16]+}++func cleanCard(c *pb.FriendCard) *pb.FriendCard {+ if c == nil {+ return &pb.FriendCard{}+ }+ trim := func(s string, n int) string {+ s = strings.Map(func(r rune) rune {+ if r < 0x20 || r == 0x7f {+ return -1+ }+ return r+ }, s)+ if len(s) > n {+ s = s[:n]+ }+ return s+ }+ out := &pb.FriendCard{+ DisplayName: trim(c.GetDisplayName(), 64),+ DeviceName: trim(c.GetDeviceName(), 64),+ Platform: trim(c.GetPlatform(), 16),+ Service: trim(c.GetService(), 16),+ }+ if len(c.GetCustomServerHash()) <= 32 {+ out.CustomServerHash = c.GetCustomServerHash()+ }+ if len(c.GetAvatarHash()) <= 32 {+ out.AvatarHash = c.GetAvatarHash()+ }+ return out+}++func (m *Manager) updateFriendCard(id string, card *pb.FriendCard) {+ card = cleanCard(card)+ m.mu.Lock()+ c, ok := m.contacts[id]+ if !ok {+ m.mu.Unlock()+ return+ }+ if card.GetDisplayName() != "" {+ c.DisplayName = card.GetDisplayName()+ }+ if card.GetDeviceName() != "" {+ c.DeviceName = card.GetDeviceName()+ }+ if card.GetPlatform() != "" {+ c.Platform = card.GetPlatform()+ }+ c.Service, c.ServerHash = card.GetService(), card.GetCustomServerHash()+ wantAvatar := len(card.GetAvatarHash()) > 0 && !bytes.Equal(card.GetAvatarHash(), c.AvatarHash)+ if len(card.GetAvatarHash()) == 0 {+ c.AvatarHash, c.AvatarPath = nil, ""+ }+ m.contacts[id] = c+ m.mu.Unlock()+ if err := m.store.PutContact(c); err != nil {+ m.log.Warn("保存好友名片失败", "device", id, "err", err)+ }+ if wantAvatar {+ _ = m.p2p.Send(id, &pb.PeerMessage{Payload: &pb.PeerMessage_AvatarRequest{+ AvatarRequest: &pb.AvatarRequest{AvatarHash: card.GetAvatarHash()}}})+ }+ m.notifyFriend(id)+}++func (m *Manager) sendAvatar(id string, want []byte) {+ if m.avatar == nil {+ return+ }+ jpeg := m.avatar()+ if len(jpeg) == 0 || len(jpeg) > maxAvatarBytes || !bytes.Equal(AvatarHash(jpeg), want) {+ return+ }+ _ = m.p2p.Send(id, &pb.PeerMessage{Payload: &pb.PeerMessage_AvatarData{+ AvatarData: &pb.AvatarData{AvatarHash: AvatarHash(jpeg), Jpeg: jpeg}}})+}++func (m *Manager) receiveAvatar(id string, d *pb.AvatarData) {+ jpeg := d.GetJpeg()+ if len(jpeg) == 0 || len(jpeg) > maxAvatarBytes || !bytes.Equal(AvatarHash(jpeg), d.GetAvatarHash()) || m.saveAvatar == nil {+ return+ }+ // 收到的头像不直接显示:后台服务重新解码、编码后存一份,界面只读这一份+ path, err := m.saveAvatar(id, jpeg)+ if err != nil {+ m.log.Warn("好友的头像不能用", "device", id, "err", err)+ return+ }+ m.mu.Lock()+ c, ok := m.contacts[id]+ if ok {+ c.AvatarHash, c.AvatarPath = d.GetAvatarHash(), path+ m.contacts[id] = c+ }+ m.mu.Unlock()+ if ok {+ _ = m.store.PutContact(c)+ m.notifyFriend(id)+ }+}++// BroadcastCard 在本机的名字、头像或服务变了以后告诉连着的好友。+func (m *Manager) BroadcastCard() {+ card := m.selfCard()+ m.mu.RLock()+ var ids []string+ for id := range m.contacts {+ if connected(m.conn[id]) {+ ids = append(ids, id)+ }+ }+ m.mu.RUnlock()+ for _, id := range ids {+ _ = m.p2p.Send(id, &pb.PeerMessage{Payload: &pb.PeerMessage_FriendCard{FriendCard: card}})+ }+}++// ─────────────────────── 加好友 ───────────────────────++// CreateFriendCode 生成好友码:F 加一个配对码。别人兑换后由 OnFriendRequest 推给界面。+func (m *Manager) CreateFriendCode(ctx context.Context) (string, time.Time, []string, error) {+ code, expires, addrs, err := m.createCode(ctx, lan.IntentFriend)+ if err != nil {+ return "", time.Time{}, nil, err+ }+ return "F" + code, expires, addrs, nil+}++// splitCode 认出好友码:F 加 6 位。去掉连字符和空白后是 7 位、以 F 开头的就是好友码+func splitCode(code string) (string, bool) {+ c := pairingcode.Normalize(code)+ if len(c) == pairingcode.Length+1 && c[0] == 'F' {+ return c[1:], true+ }+ return c, false+}++// RedeemFriendCode 兑换好友码,返回对方的名片和会话;用户确认后调 ConfirmFriend。+func (m *Manager) RedeemFriendCode(ctx context.Context, code, address string) (*pb.FriendRequest, error) {+ code, _ = splitCode(code)+ var extra []netip.AddrPort+ if address != "" {+ aps, err := lan.ResolveAddress(ctx, address)+ if err != nil {+ return nil, err+ }+ extra = aps+ }+ lanErr := lan.ErrDisabled+ if m.lan.Running() {+ wait := 3 * time.Second+ if len(extra) > 0 {+ wait = 5 * time.Second+ }+ lctx, cancel := context.WithTimeout(ctx, wait)+ peer, err := m.lan.PairFor(lctx, code, extra, lan.IntentFriend, m.selfCard())+ cancel()+ if err == nil {+ dev := store.Device{ID: peer.ID, Name: peer.Name, Platform: peer.Platform, PublicKey: peer.PublicKey}+ session, err := m.addPendingFor(dev, false, peer.Addrs, lan.IntentFriend, peer.Intent, peer.Card)+ if err != nil {+ return nil, err+ }+ return m.friendRequest(session)+ }+ if errors.Is(err, lan.ErrIsDeviceCode) {+ return nil, ErrIsDeviceCode+ }+ lanErr = err+ }+ if m.client.Connected() {+ session, err := m.redeemViaServerFor(ctx, code, lan.IntentFriend)+ if err != nil {+ if errors.Is(lanErr, lan.ErrWrongCode) || errors.Is(lanErr, lan.ErrTooManyAttempts) || errors.Is(lanErr, lan.ErrCodeClosed) {+ return nil, lanErr+ }+ return nil, err+ }+ return m.awaitIntent(ctx, session)+ }+ if errors.Is(lanErr, lan.ErrDisabled) {+ return nil, ErrNoChannel+ }+ return nil, lanErr+}++// awaitIntent 等经服务器兑换的对方说明用途。不一致或一直没有(旧版本)就放弃这次加好友+func (m *Manager) awaitIntent(ctx context.Context, session string) (*pb.FriendRequest, error) {+ m.mu.RLock()+ p := m.pending[session]+ m.mu.RUnlock()+ if p == nil {+ return nil, ErrSessionUnknown+ }+ select {+ case <-p.intentKnown:+ case <-ctx.Done():+ m.dropPending(session)+ return nil, ctx.Err()+ case <-time.After(intentWait):+ m.dropPending(session)+ return nil, ErrPeerOutdated+ }+ m.mu.RLock()+ err := p.mismatch+ m.mu.RUnlock()+ if err != nil {+ return nil, err+ }+ return m.friendRequest(session)+}++func (m *Manager) dropPending(session string) {+ m.mu.Lock()+ if p, ok := m.pending[session]; ok {+ delete(m.pending, session)+ delete(m.stashed, p.peer.ID)+ }+ m.mu.Unlock()+}++func (m *Manager) friendRequest(session string) (*pb.FriendRequest, error) {+ m.mu.RLock()+ p, ok := m.pending[session]+ m.mu.RUnlock()+ if !ok {+ return nil, ErrSessionUnknown+ }+ card := cleanCard(p.peerCard)+ name := card.GetDeviceName()+ if name == "" {+ name = p.peer.Name+ }+ return &pb.FriendRequest{+ Session: session,+ DeviceId: p.peer.ID,+ DisplayName: card.GetDisplayName(),+ DeviceName: name,+ Platform: p.peer.Platform,+ Fingerprint: deviceid.Fingerprint(p.peer.PublicKey),+ SelfFingerprint: m.identity.Fingerprint(),+ }, nil+}++// exchangeIntent 经服务器兑换配对码后,把本端的用途发给对方,直到收到对方的或会话结束。+func (m *Manager) exchangeIntent(session string) {+ for i := 0; i < int(intentWait/time.Second)+3; i++ {+ m.mu.RLock()+ p, ok := m.pending[session]+ done := ok && p.peerIntent != ""+ m.mu.RUnlock()+ if !ok || done {+ return+ }+ m.sendIntent(p)+ time.Sleep(time.Second)+ }+}++func (m *Manager) sendIntent(p *pendingPair) {+ msg := &pb.PairIntent{Intent: p.intent}+ if p.intent == lan.IntentFriend {+ msg.Card = m.selfCard()+ }+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ defer cancel()+ _ = m.sendSignal(ctx, p.peer.ID, &pb.SignalMessage{Payload: &pb.SignalMessage_PairIntent{PairIntent: msg}})+}++func (m *Manager) handlePairIntent(from string, in *pb.PairIntent) {+ intent := lan.IntentDevice+ if in.GetIntent() == lan.IntentFriend {+ intent = lan.IntentFriend+ }+ m.mu.Lock()+ var p *pendingPair+ for _, q := range m.pending {+ if q.peer.ID == from {+ p = q+ break+ }+ }+ if p == nil {+ m.mu.Unlock()+ return+ }+ first := p.peerIntent == ""+ p.peerIntent = intent+ if in.GetCard() != nil {+ p.peerCard = cleanCard(in.GetCard())+ }+ m.mu.Unlock()+ if first {+ // 对方可能还没收到本端的,回一条+ go m.sendIntent(p)+ }+ m.evaluateIntent(p)+}++// evaluateIntent 在两边的用途都知道以后:一致的加好友弹出确认框;不一致就作废这次配对。+func (m *Manager) evaluateIntent(p *pendingPair) {+ m.mu.Lock()+ if p.peerIntent == "" || p.intentDone {+ m.mu.Unlock()+ return+ }+ p.intentDone = true+ announce := false+ switch {+ case p.intent == lan.IntentFriend && p.peerIntent == lan.IntentFriend:+ announce = p.initiated+ case p.intent == lan.IntentFriend:+ p.mismatch = ErrIsDeviceCode+ delete(m.pending, p.session)+ case p.peerIntent == lan.IntentFriend:+ // 本端在配对,对方开放的是好友码+ p.mismatch = ErrIsFriendCode+ delete(m.pending, p.session)+ m.mismatched[p.session] = ErrIsFriendCode+ }+ close(p.intentKnown)+ m.mu.Unlock()+ if p.mismatch != nil {+ m.log.Info("配对用途不一致,作废", "peer", p.peer.ID, "本端", p.intent, "对方", p.peerIntent)+ }+ if announce && m.onFriendRequest != nil {+ if req, err := m.friendRequest(p.session); err == nil {+ m.onFriendRequest(req)+ }+ }+}++// ConfirmFriend 是用户在加好友的确认框里点了「添加」或「取消」。两边都添加了才成为好友,+// 结果由 OnFriendChanged(成为好友)或 OnFriendRemoved(对方取消了)推给界面。+func (m *Manager) ConfirmFriend(ctx context.Context, session string, accept bool) error {+ m.mu.Lock()+ p, ok := m.pending[session]+ if ok && p.intent != lan.IntentFriend {+ ok = false+ }+ if ok {+ if accept {+ p.localDecision = 1+ } else {+ delete(m.pending, session)+ }+ }+ m.mu.Unlock()+ if !ok {+ return ErrSessionUnknown+ }+ if !accept {+ m.log.Info("用户没有添加好友", "peer", p.peer.ID)+ go m.sendConfirm(p.peer.ID, false, 3)+ return nil+ }+ if m.finalizeFriend(p) {+ return nil+ }+ go m.confirmLoop(session)+ return nil+}++// confirmLoop 反复告诉对方本端已添加,直到对方也决定了或会话过期。+func (m *Manager) confirmLoop(session string) {+ for {+ m.mu.RLock()+ p, ok := m.pending[session]+ m.mu.RUnlock()+ if !ok || time.Now().After(p.expiresAt) {+ return+ }+ m.sendConfirm(p.peer.ID, true, 1)+ time.Sleep(2 * time.Second)+ }+}++func (m *Manager) sendConfirm(to string, accepted bool, times int) {+ for i := 0; i < times; i++ {+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ _ = m.sendSignal(ctx, to, &pb.SignalMessage{Payload: &pb.SignalMessage_FriendConfirm{+ FriendConfirm: &pb.FriendConfirm{Accepted: accepted}}})+ cancel()+ if i+1 < times {+ time.Sleep(time.Second)+ }+ }+}++func (m *Manager) handleFriendConfirm(from string, c *pb.FriendConfirm) {+ m.mu.Lock()+ var p *pendingPair+ for _, q := range m.pending {+ if q.peer.ID == from && q.intent == lan.IntentFriend {+ p = q+ break+ }+ }+ _, isFriend := m.contacts[from]+ if p != nil {+ if c.GetAccepted() {+ p.peerDecision = 1+ } else {+ delete(m.pending, p.session)+ }+ }+ m.mu.Unlock()+ switch {+ case p == nil && isFriend && c.GetAccepted():+ // 本端已经成为好友了,对方还没收到本端的确认+ go m.sendConfirm(from, true, 1)+ case p != nil && !c.GetAccepted():+ m.log.Info("对方没有添加好友", "peer", from)+ if m.onFriendRemoved != nil {+ m.onFriendRemoved(from)+ }+ case p != nil:+ if m.finalizeFriend(p) {+ go m.sendConfirm(from, true, 1)+ }+ }+}++// finalizeFriend 在两边都添加了以后保存好友,返回是否保存了。+func (m *Manager) finalizeFriend(p *pendingPair) bool {+ m.mu.Lock()+ if p.localDecision != 1 || p.peerDecision != 1 {+ m.mu.Unlock()+ return false+ }+ if _, still := m.pending[p.session]; !still {+ m.mu.Unlock()+ return false+ }+ delete(m.pending, p.session)+ card := cleanCard(p.peerCard)+ c := store.Contact{+ ID: p.peer.ID, PublicKey: p.peer.PublicKey, DisplayName: card.GetDisplayName(),+ DeviceName: card.GetDeviceName(), Platform: p.peer.Platform, Service: card.GetService(),+ ServerHash: card.GetCustomServerHash(), AddedAt: time.Now(),+ }+ if c.DeviceName == "" {+ c.DeviceName = p.peer.Name+ }+ if card.GetPlatform() != "" {+ c.Platform = card.GetPlatform()+ }+ m.contacts[c.ID] = c+ delete(m.notices, c.ID)+ m.mu.Unlock()+ if err := m.store.PutContact(c); err != nil {+ m.log.Warn("保存好友失败", "device", c.ID, "err", err)+ }+ _ = m.store.DeletePendingNotice(c.ID)+ m.log.Info("已加为好友", "device", c.ID, "name", c.DisplayName)+ if len(p.addrs) > 0 {+ m.lan.Remember(c.ID, p.addrs)+ }+ m.lan.PeersChanged()+ if m.client.Connected() {+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ _ = m.client.RefreshPaired(ctx)+ cancel()+ }+ m.notifyFriend(c.ID)+ m.replaySignals(c.ID)+ // 连上一次,交换功能声明和名片、头像;空闲后自动断开+ go m.ConnectFriend(c.ID)+ return true+}++// ─────────────────────── 好友列表 ───────────────────────++func (m *Manager) Friends() []*pb.Friend {+ m.mu.RLock()+ defer m.mu.RUnlock()+ out := make([]*pb.Friend, 0, len(m.contacts))+ for _, c := range m.contacts {+ out = append(out, m.friendLocked(c))+ }+ slices.SortFunc(out, func(a, b *pb.Friend) int { return int(a.GetAddedAtUnix() - b.GetAddedAtUnix()) })+ return out+}++func (m *Manager) Friend(id string) (*pb.Friend, bool) {+ m.mu.RLock()+ defer m.mu.RUnlock()+ c, ok := m.contacts[id]+ if !ok {+ return nil, false+ }+ return m.friendLocked(c), true+}++// FriendContact 返回好友的存储记录(隔空传送取名字用)+func (m *Manager) FriendContact(id string) (store.Contact, bool) {+ m.mu.RLock()+ defer m.mu.RUnlock()+ c, ok := m.contacts[id]+ return c, ok+}++func (m *Manager) friendLocked(c store.Contact) *pb.Friend {+ online := m.isOnlineLocked(c.ID)+ conn := pb.ConnectionKind_CONNECTION_KIND_OFFLINE+ if online {+ conn = m.conn[c.ID].Proto()+ }+ f, declared := m.features[c.ID]+ var last int64+ if !c.LastActivity.IsZero() {+ last = c.LastActivity.Unix()+ }+ return &pb.Friend{+ Id: c.ID,+ DisplayName: c.DisplayName,+ DeviceName: c.DeviceName,+ Platform: c.Platform,+ Online: online,+ Connection: conn,+ LanReachable: online && m.lan.Reachable(c.ID),+ FeaturesKnown: declared || m.legacy[c.ID],+ ReceivesFiles: f[FeatureSendAsk] && f[FeatureSendFiles],+ ReceiveDisabled: f[FeatureSendFilesOff],+ AppVersion: m.peerVersion[c.ID],+ AutoAccept: c.AutoAccept,+ AddedAtUnix: c.AddedAt.Unix(),+ LastActivityUnix: last,+ Reachability: m.reachabilityLocked(c, online),+ HasAvatar: c.AvatarPath != "",+ AvatarHash: c.AvatarHash,+ Fingerprint: deviceid.Fingerprint(c.PublicKey),+ }+}++// reachabilityLocked 是好友不在线时连不上的可能原因,见 design/friends-send.md 第 9.2 节。+// 在线、或者两边用的是同一种服务(对方只是没开机)时为空+func (m *Manager) reachabilityLocked(c store.Contact, online bool) string {+ if online {+ return ""+ }+ cfg := m.loadConfig()+ mine := serviceOf(cfg)+ switch {+ case mine == "lan":+ return "self_no_service"+ case c.Service == "lan":+ return "peer_no_service"+ case c.Service == "":+ return "" // 还没收到过对方的名片+ case mine != c.Service:+ return "different_server"+ case mine == "custom" && !bytes.Equal(ServiceHash(cfg.EffectiveSignalingURL()), c.ServerHash):+ return "different_server"+ }+ return ""+}++func serviceOf(cfg config.Config) string {+ switch {+ case cfg.Official():+ return "official"+ case cfg.EffectiveSignalingURL() != "":+ return "custom"+ }+ return "lan"+}++// SetFriendAutoAccept 打开或关掉自动接收某个好友的文件+func (m *Manager) SetFriendAutoAccept(id string, auto bool) (*pb.Friend, error) {+ if err := m.store.SetContactAutoAccept(id, auto); err != nil {+ if errors.Is(err, store.ErrNoContact) {+ return nil, ErrNotFriend+ }+ return nil, err+ }+ m.mu.Lock()+ c, ok := m.contacts[id]+ if ok {+ c.AutoAccept = auto+ m.contacts[id] = c+ }+ m.mu.Unlock()+ m.notifyFriend(id)+ f, _ := m.Friend(id)+ return f, nil+}++// TouchFriend 记下和好友最近一次传输的时间+func (m *Manager) TouchFriend(id string) {+ now := time.Now()+ m.mu.Lock()+ c, ok := m.contacts[id]+ if ok {+ c.LastActivity = now+ m.contacts[id] = c+ }+ m.mu.Unlock()+ if ok {+ _ = m.store.TouchContact(id, now)+ m.notifyFriend(id)+ }+}++func (m *Manager) notifyFriend(id string) {+ if m.onFriendChanged == nil {+ return+ }+ if f, ok := m.Friend(id); ok {+ m.onFriendChanged(f)+ }+}++// ─────────────────────── 删除好友 ───────────────────────++// RemoveFriend 删除好友:两边都删。对方不在线时记下来,连上再告诉它(最多 30 天)。+func (m *Manager) RemoveFriend(ctx context.Context, id string) error {+ m.mu.Lock()+ c, ok := m.contacts[id]+ if ok {+ delete(m.contacts, id)+ delete(m.features, id)+ m.notices[id] = c.PublicKey+ }+ m.mu.Unlock()+ if !ok {+ return ErrNotFriend+ }+ if err := m.store.DeleteContact(id); err != nil {+ return err+ }+ _ = m.store.PutPendingNotice(id, c.PublicKey, time.Now())+ m.p2p.Disconnect(id)+ m.mu.Lock()+ delete(m.conn, id)+ m.mu.Unlock()+ m.lan.PeersChanged()+ if m.client.Connected() {+ _ = m.client.RefreshPaired(ctx)+ }+ m.log.Info("已删除好友", "device", id)+ if m.onFriendRemoved != nil {+ m.onFriendRemoved(id)+ }+ go m.noticeLoop(id)+ return nil+}++// noticeLoop 删除好友后的头 15 秒里每秒补发一次,直到收到回执;之后靠对方上线时和每 30 秒的巡检补发+func (m *Manager) noticeLoop(id string) {+ for i := 0; i < 15; i++ {+ m.mu.RLock()+ _, pending := m.notices[id]+ m.mu.RUnlock()+ if !pending {+ return+ }+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ _ = m.sendSignal(ctx, id, &pb.SignalMessage{Payload: &pb.SignalMessage_FriendRemove{+ FriendRemove: &pb.FriendRemove{AtUnix: time.Now().Unix()}}})+ cancel()+ time.Sleep(time.Second)+ }+}++// sendNotices 给还没收到删除通知、此刻找得到的对方补发一次+func (m *Manager) sendNotices() {+ // 找不到对方时 sendSignal 直接返回错误,不必先判断在不在线+ m.mu.RLock()+ var ids []string+ for id := range m.notices {+ ids = append(ids, id)+ }+ m.mu.RUnlock()+ for _, id := range ids {+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ _ = m.sendSignal(ctx, id, &pb.SignalMessage{Payload: &pb.SignalMessage_FriendRemove{+ FriendRemove: &pb.FriendRemove{AtUnix: time.Now().Unix()}}})+ cancel()+ }+}++func (m *Manager) handleFriendRemove(from string, r *pb.FriendRemove) {+ if r.GetAck() {+ m.mu.Lock()+ _, had := m.notices[from]+ delete(m.notices, from)+ m.mu.Unlock()+ if had {+ _ = m.store.DeletePendingNotice(from)+ m.lan.PeersChanged()+ m.log.Info("对方已收到删除好友的通知", "device", from)+ }+ return+ }+ m.mu.Lock()+ _, isFriend := m.contacts[from]+ if isFriend {+ delete(m.contacts, from)+ delete(m.features, from)+ }+ m.mu.Unlock()+ if isFriend {+ _ = m.store.DeleteContact(from)+ m.p2p.Disconnect(from)+ m.mu.Lock()+ delete(m.conn, from)+ m.mu.Unlock()+ m.lan.PeersChanged()+ m.log.Info("对方删除了好友", "device", from)+ if m.onFriendRemoved != nil {+ m.onFriendRemoved(from)+ }+ }+ // 回执:本端还认得对方的公钥(签名已经验过),对方收到就不再补发+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ defer cancel()+ _ = m.sendSignal(ctx, from, &pb.SignalMessage{Payload: &pb.SignalMessage_FriendRemove{+ FriendRemove: &pb.FriendRemove{AtUnix: time.Now().Unix(), Ack: true}}})+}++// ─────────────────────── 连接 ───────────────────────++// ConnectFriend 建立与好友(或陌生设备)的连接:发文件、交换名片时用。+// 本端是应答方时请对方来连(RetryDirect 信令)。+func (m *Manager) ConnectFriend(id string) {+ if m.Role(id) == "" {+ return+ }+ m.touch(id)+ if st := m.p2p.State(id); st != p2p.StateOffline {+ return+ }+ ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)+ defer cancel()+ var err error+ if m.identity.DeviceID < id {+ err = m.p2p.Connect(ctx, id)+ } else {+ err = m.p2p.RetryDirect(ctx, id)+ }+ if err != nil {+ m.log.Debug("连接好友失败", "device", id, "err", err)+ }+}++// dropIdleOthers 断开空闲的好友与陌生设备:只在要发文件时连着。+func (m *Manager) dropIdleOthers() {+ now := time.Now()+ m.mu.RLock()+ var idle []string+ for id, st := range m.conn {+ role := m.roleLocked(id)+ if role == RoleSelf || !connected(st) {+ continue+ }+ if now.Sub(m.lastUse[id]) > friendIdle && (m.inUse == nil || !m.inUse(id)) {+ idle = append(idle, id)+ }+ }+ m.mu.RUnlock()+ for _, id := range idle {+ m.log.Info("好友的连接空闲,断开", "device", id)+ m.p2p.Disconnect(id)+ m.mu.Lock()+ delete(m.conn, id)+ m.mu.Unlock()+ m.notifyFriend(id)+ }+}++// loadContacts 在启动时读回好友和待补发的删除通知。+func (m *Manager) loadContacts() error {+ contacts, err := m.store.ListContacts()+ if err != nil {+ return fmt.Errorf("读取好友: %w", err)+ }+ for _, c := range contacts {+ m.contacts[c.ID] = c+ if len(c.Features) > 0 {+ m.features[c.ID] = featureSet(c.Features)+ m.peerVersion[c.ID] = c.AppVersion+ }+ }+ notices, err := m.store.PendingNotices(time.Now().Add(-noticeKeep))+ if err != nil {+ return fmt.Errorf("读取删除好友的通知: %w", err)+ }+ for _, n := range notices {+ m.notices[n.ID] = n.PublicKey+ }+ return nil+}diff --git a/client-core/internal/peers/friends_test.go b/client-core/internal/peers/friends_test.gonew file mode 100644index 0000000..b4189d9--- /dev/null+++ b/client-core/internal/peers/friends_test.go@@ -0,0 +1,245 @@+package peers++import (+ "context"+ "errors"+ "net/http/httptest"+ "strings"+ "testing"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/transport/lan"+ "github.com/baiyuze/pasteferry/client-core/internal/transport/p2p"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+ "github.com/baiyuze/pasteferry/server/signal"+)++// friendDevice 是带好友回调的测试设备:好友码被兑换时推来的确认请求、好友变化都记下来。+type friendEvents struct {+ requests chan *pb.FriendRequest+ removed chan string+}++func newFriendDevice(t *testing.T, name string, net *lan.MemoryNetwork, cfg config.Config) (*device, *friendEvents) {+ t.Helper()+ d := newDevice(t, name, net, cfg)+ ev := &friendEvents{requests: make(chan *pb.FriendRequest, 4), removed: make(chan string, 4)}+ d.m.onFriendRequest = func(r *pb.FriendRequest) { ev.requests <- r }+ d.m.onFriendRemoved = func(id string) { ev.removed <- id }+ d.m.card = func() *pb.FriendCard {+ return &pb.FriendCard{DisplayName: "用户 " + name, DeviceName: name, Platform: "darwin", Service: "lan"}+ }+ d.m.shareableStream = func(label string) bool { return strings.HasPrefix(label, "send:") }+ return d, ev+}++// addFriends 走一遍加好友:a 显示好友码,b 输入;两边都点「添加」。+func addFriends(t *testing.T, a, b *device, aev *friendEvents) {+ t.Helper()+ ctx := context.Background()+ code, _, _, err := a.m.CreateFriendCode(ctx)+ if err != nil {+ t.Fatalf("生成好友码: %v", err)+ }+ if len(code) != 7 || code[0] != 'F' {+ t.Fatalf("好友码格式不对: %q", code)+ }+ req, err := b.m.RedeemFriendCode(ctx, "f-"+strings.ToLower(code[1:]), "")+ if err != nil {+ t.Fatalf("兑换好友码: %v", err)+ }+ if req.GetDeviceId() != a.id() || req.GetDisplayName() != "用户 a" {+ t.Fatalf("对方的名片不对: %v", req)+ }+ var aReq *pb.FriendRequest+ select {+ case aReq = <-aev.requests:+ case <-time.After(15 * time.Second):+ t.Fatal("显示好友码的一方没收到确认请求")+ }+ if aReq.GetDeviceId() != b.id() || aReq.GetDisplayName() != "用户 b" {+ t.Fatalf("a 看到的名片不对: %v", aReq)+ }+ if err := b.m.ConfirmFriend(ctx, req.GetSession(), true); err != nil {+ t.Fatal(err)+ }+ if _, ok := b.m.Friend(a.id()); ok {+ t.Fatal("对方还没添加,不该成为好友")+ }+ if err := a.m.ConfirmFriend(ctx, aReq.GetSession(), true); err != nil {+ t.Fatal(err)+ }+ waitFor(t, "两边都成为好友", func() bool {+ _, ok1 := a.m.Friend(b.id())+ _, ok2 := b.m.Friend(a.id())+ return ok1 && ok2+ })+}++// 局域网里加好友:好友不是配对设备,只能收发隔空传送的消息。+func TestAddFriendOnLAN(t *testing.T) {+ network := lan.NewMemoryNetwork()+ a, aev := newFriendDevice(t, "a", network, lanOnly())+ b, _ := newFriendDevice(t, "b", network, lanOnly())+ waitLANUp(t, a, b)+ addFriends(t, a, b, aev)++ if role := a.m.Role(b.id()); role != RoleFriend {+ t.Fatalf("角色应当是好友,得到 %q", role)+ }+ if devices, _ := a.m.store.ListDevices(); len(devices) != 0 {+ t.Fatalf("好友不该进配对设备: %v", devices)+ }+ // 加上后连一次,交换功能声明与名片+ waitFor(t, "好友连上并交换功能声明", func() bool {+ f, _ := a.m.Friend(b.id())+ return connected(a.m.P2P().State(b.id())) && f.GetFeaturesKnown() && f.GetReceivesFiles()+ })+ f, _ := a.m.Friend(b.id())+ if f.GetDisplayName() != "用户 b" || f.GetDeviceName() != "b" {+ t.Fatalf("好友的名片不对: %v", f)+ }++ // 剪贴板同步的消息不放行,隔空传送的放行+ clip := &pb.PeerMessage{Payload: &pb.PeerMessage_Fetch{Fetch: &pb.PeerFetch{ClipId: "secret"}}}+ if err := b.m.P2P().Send(a.id(), clip); err != nil {+ t.Fatal(err)+ }+ offer := &pb.PeerMessage{Payload: &pb.PeerMessage_SendOffer{SendOffer: &pb.SendOffer{TransferId: "t1"}}}+ if err := b.m.P2P().Send(a.id(), offer); err != nil {+ t.Fatal(err)+ }+ select {+ case got := <-a.messages:+ if got.GetSendOffer().GetTransferId() != "t1" {+ t.Fatalf("好友发来的剪贴板消息漏了进来: %v", got)+ }+ case <-time.After(5 * time.Second):+ t.Fatal("好友发来的隔空传送消息没到")+ }+ select {+ case got := <-a.messages:+ t.Fatalf("不该再收到消息: %v", got)+ case <-time.After(300 * time.Millisecond):+ }+}++// 用途不一致:好友码输进「添加设备」、配对码输进「添加好友」都被回绝,码也不会被用掉。+func TestFriendCodeIntentMismatchOnLAN(t *testing.T) {+ network := lan.NewMemoryNetwork()+ a, aev := newFriendDevice(t, "a", network, lanOnly())+ b, _ := newFriendDevice(t, "b", network, lanOnly())+ waitLANUp(t, a, b)+ ctx := context.Background()++ code, _, _, err := a.m.CreateFriendCode(ctx)+ if err != nil {+ t.Fatal(err)+ }+ if _, _, err := b.m.RedeemPairingCode(ctx, code, ""); !errors.Is(err, ErrIsFriendCode) {+ t.Fatalf("带 F 的好友码输进添加设备: %v", err)+ }+ // 去掉 F 当配对码输:局域网里回绝,码还在+ if _, _, err := b.m.RedeemPairingCode(ctx, code[1:], ""); !errors.Is(err, ErrIsFriendCode) {+ t.Fatalf("去掉 F 的好友码输进添加设备: %v", err)+ }+ if _, err := b.m.RedeemFriendCode(ctx, code, ""); err != nil {+ t.Fatalf("码被用掉了: %v", err)+ }+ select {+ case <-aev.requests:+ case <-time.After(5 * time.Second):+ t.Fatal("没收到确认请求")+ }++ pcode, _, _, err := a.m.CreatePairingCode(ctx)+ if err != nil {+ t.Fatal(err)+ }+ if _, err := b.m.RedeemFriendCode(ctx, pcode, ""); !errors.Is(err, ErrIsDeviceCode) {+ t.Fatalf("配对码输进添加好友: %v", err)+ }+}++// 删除好友:两边都删;不在线的一方上线后补发。+func TestRemoveFriend(t *testing.T) {+ network := lan.NewMemoryNetwork()+ a, aev := newFriendDevice(t, "a", network, lanOnly())+ b, bev := newFriendDevice(t, "b", network, lanOnly())+ waitLANUp(t, a, b)+ addFriends(t, a, b, aev)+ if err := a.m.RemoveFriend(context.Background(), b.id()); err != nil {+ t.Fatal(err)+ }+ select {+ case id := <-bev.removed:+ if id != a.id() {+ t.Fatalf("删错了: %s", id)+ }+ case <-time.After(10 * time.Second):+ t.Fatal("对方没收到删除好友的通知")+ }+ if _, ok := b.m.Friend(a.id()); ok {+ t.Fatal("对方还留着好友")+ }+ waitFor(t, "收到回执后不再补发", func() bool {+ a.m.mu.RLock()+ defer a.m.mu.RUnlock()+ return len(a.m.notices) == 0+ })+ if role := b.m.Role(a.id()); role != "" {+ t.Fatalf("删除后不该还有角色: %q", role)+ }+}++// 只用服务器:好友码经服务器兑换,两边用签名的信令交换用途。+func TestAddFriendViaServer(t *testing.T) {+ srv := httptest.NewServer(signal.NewServer(signal.Options{}))+ t.Cleanup(srv.Close)+ cfg := config.Default()+ cfg.SignalingURL = "ws" + strings.TrimPrefix(srv.URL, "http") + "/signal"+ cfg.LANDisabled = true+ cfg.OnlyOwnSTUN = true++ a, aev := newFriendDevice(t, "a", nil, cfg)+ b, _ := newFriendDevice(t, "b", nil, cfg)+ c, _ := newFriendDevice(t, "c", nil, cfg)+ waitFor(t, "连上服务器", func() bool { return a.m.Connected() && b.m.Connected() && c.m.Connected() })+ addFriends(t, a, b, aev)+ if a.m.Role(b.id()) != RoleFriend || b.m.Role(a.id()) != RoleFriend {+ t.Fatal("没成为好友")+ }++ // 配对码输进「添加好友」:对方说明这是配对,回绝+ ctx := context.Background()+ pcode, _, _, err := a.m.CreatePairingCode(ctx)+ if err != nil {+ t.Fatal(err)+ }+ if _, err := c.m.RedeemFriendCode(ctx, pcode, ""); !errors.Is(err, ErrIsDeviceCode) {+ t.Fatalf("配对码输进添加好友: %v", err)+ }+ // 好友码去掉 F 输进「添加设备」:确认时报出原因+ code, _, _, err := a.m.CreateFriendCode(ctx)+ if err != nil {+ t.Fatal(err)+ }+ _, session, err := c.m.RedeemPairingCode(ctx, code[1:], "")+ if err != nil {+ t.Fatal(err)+ }+ waitFor(t, "知道这是好友码", func() bool {+ c.m.mu.RLock()+ defer c.m.mu.RUnlock()+ return c.m.mismatched[session] != nil+ })+ if err := c.m.ConfirmPairing(ctx, session, true); !errors.Is(err, ErrIsFriendCode) {+ t.Fatalf("确认时应当报出这是好友码: %v", err)+ }+ if devices, _ := c.m.store.ListDevices(); len(devices) != 0 {+ t.Fatalf("好友码被当成配对码配上了: %v", devices)+ }+}++var _ = p2p.StateOfflinediff --git a/client-core/internal/peers/manager.go b/client-core/internal/peers/manager.goindex d2bf275..a7ef1d1 100644--- a/client-core/internal/peers/manager.go+++ b/client-core/internal/peers/manager.go@@ -45,6 +45,18 @@ type pendingPair struct {initiated bool// addrs 是在局域网里配对时对方的地址,确认后写进地址簿addrs []string++ // 这次是配对还是加好友(lan.IntentDevice / lan.IntentFriend),对方的用途(不知道时为空)+ // 和名片。两边的用途一致才继续,见 friends.go+ intent string+ peerIntent string+ peerCard *pb.FriendCard+ intentKnown chan struct{} // 知道对方的用途后关闭+ intentDone bool+ mismatch error+ // 加好友:两边的用户各自点了「添加」(1)或「取消」(-1)+ localDecision int+ peerDecision int}const pendingTTL = 5 * time.Minute@@ -55,6 +67,7 @@ type activeCode struct {code stringexpires time.Timeused bool+ intent string // 配对码还是好友码}type redeemResult struct {@@ -102,7 +115,28 @@ type Manager struct {appVersion string// noFeatures 让测试模拟不发功能声明的旧版本noFeatures bool- pending map[string]*pendingPair // session -> 待确认配对++ // 好友(对方的一台电脑),见 friends.go+ contacts map[string]store.Contact+ // 「所有人」模式下认识的陌生设备,只在内存里+ strangers map[string]store.Contact+ // 删除了好友、还没告诉对方的:设备 ID → 对方公钥(验对方回执的签名)+ notices map[string][]byte+ // 和好友、陌生设备最近一次收发的时间,空闲的断开+ lastUse map[string]time.Time+ // 用途不一致而作废的配对会话,ConfirmPairing 据此给出原因+ mismatched map[string]error++ card func() *pb.FriendCard+ avatar func() []byte+ saveAvatar func(deviceID string, jpeg []byte) (string, error)+ onFriendChanged func(*pb.Friend)+ onFriendRemoved func(deviceID string)+ onFriendRequest func(*pb.FriendRequest)+ onOtherReady func(deviceID string)+ shareableStream func(label string) bool+ inUse func(deviceID string) bool+ pending map[string]*pendingPair // session -> 待确认配对// stashed 暂存配对确认前到达的信令,按对端 device_id 归集stashed map[string][]*pb.SignalMessageactive *activeCode@@ -137,6 +171,23 @@ type Options struct {LANDiscovery lan.Discovery// AppVersion 是本机的版本号,随功能声明发给对端,对端用它提示「需要更新到哪个版本」AppVersion string++ // 好友(2.6.0)。Card 是发给好友的本机名片;Avatar 是本机头像(JPEG,没有时为空);+ // SaveAvatar 把好友发来的头像重新编码后存下,返回存放的路径+ Card func() *pb.FriendCard+ Avatar func() []byte+ SaveAvatar func(deviceID string, jpeg []byte) (string, error)+ // OnFriendChanged 好友加上或状态变化;OnFriendRemoved 好友被删除(任一方)或加好友时对方取消了;+ // OnFriendRequest 有人兑换了本机的好友码,界面弹出确认框+ OnFriendChanged func(*pb.Friend)+ OnFriendRemoved func(deviceID string)+ OnFriendRequest func(*pb.FriendRequest)+ // OnOtherReady 与好友或陌生设备的连接建立时调用(隔空传送据此开始发);OnPeerReady 只给自己的设备+ OnOtherReady func(deviceID string)+ // ShareableStream 判断好友、陌生设备开来的数据流能不能收(隔空传送的),其余一律关掉+ ShareableStream func(label string) bool+ // InUse 报告与某台电脑之间是否还有传输在进行,空闲断开好友连接时据此跳过+ InUse func(deviceID string) bool}// legacyWait 是连上以后等对端功能声明的时间。旧版本(2.5.0 之前)从不发声明,@@ -166,6 +217,20 @@ func NewManager(opts Options) (*Manager, error) {declared: make(map[string]bool),legacy: make(map[string]bool),appVersion: opts.AppVersion,+ contacts: make(map[string]store.Contact),+ strangers: make(map[string]store.Contact),+ notices: make(map[string][]byte),+ lastUse: make(map[string]time.Time),+ mismatched: make(map[string]error),+ card: opts.Card,+ avatar: opts.Avatar,+ saveAvatar: opts.SaveAvatar,+ onFriendChanged: opts.OnFriendChanged,+ onFriendRemoved: opts.OnFriendRemoved,+ onFriendRequest: opts.OnFriendRequest,+ onOtherReady: opts.OnOtherReady,+ shareableStream: opts.ShareableStream,+ inUse: opts.InUse,pending: make(map[string]*pendingPair),stashed: make(map[string][]*pb.SignalMessage),}@@ -181,6 +246,9 @@ func NewManager(opts Options) (*Manager, error) {m.peerVersion[d.ID] = d.AppVersion}}+ if err := m.loadContacts(); err != nil {+ return nil, err+ }m.gateway, err = gateway.NewClient(opts.Identity, gateway.OfficialBaseURL, func(u gateway.Usage) {m.notifyStatus()@@ -201,6 +269,15 @@ func NewManager(opts Options) (*Manager, error) {SendSignal: m.sendSignal,OnState: m.handleP2PState,OnMessage: func(id string, msg *pb.PeerMessage) {+ if role := m.Role(id); role != RoleSelf {+ if role == "" || m.handleOtherMessage(id, role, msg) {+ return+ }+ if opts.OnPeerMessage != nil {+ opts.OnPeerMessage(id, msg)+ }+ return+ }if display := msg.GetDisplay(); display != nil {m.updatePeerDisplay(id, display)return@@ -213,7 +290,22 @@ func NewManager(opts Options) (*Manager, error) {opts.OnPeerMessage(id, msg)}},- OnStream: opts.OnPeerStream,+ OnStream: func(id, label string, stream *p2p.Stream) {+ if role := m.Role(id); role != RoleSelf {+ // 好友、陌生设备只能开隔空传送的数据流+ if role == "" || m.shareableStream == nil || !m.shareableStream(label) {+ m.log.Warn("关掉非自己设备开来的数据流", "device", id, "role", role, "label", label)+ stream.Close()+ return+ }+ m.touch(id)+ }+ if opts.OnPeerStream != nil {+ opts.OnPeerStream(id, label, stream)+ } else {+ stream.Close()+ }+ },StatePath: opts.StatePath,// 公共 STUN 服务器 IP 分散,能探测到更多出口;用户可以在设置里关掉。// 没有服务器时只在局域网里连,探测出口没有用,还会把公网 IP 暴露给公共服务器@@ -234,17 +326,18 @@ func NewManager(opts Options) (*Manager, error) {Discovery: opts.LANDiscovery,Verifier: m.verifier,Book: opts.Store,- Peers: m.pairedIDs,+ Peers: m.lanPeerIDs,Connected: func(id string) bool { return connected(m.p2p.State(id)) },DeviceInfo: func() (string, string) {return m.loadConfig().DeviceName, runtime.GOOS},- OnSignal: m.handleSignal,- OnReachable: m.handleLANReachable,- OnRestarted: m.handlePeerRestarted,- AcceptPair: m.acceptLANPair,- AcceptNearby: m.acceptNearby,- OnChange: m.notifyStatus,+ OnSignal: m.handleSignal,+ OnReachable: m.handleLANReachable,+ OnRestarted: m.handlePeerRestarted,+ AcceptPair: m.acceptLANPair,+ AcceptNearby: m.acceptNearby,+ AcceptStranger: m.acceptStranger,+ OnChange: m.notifyStatus,})m.client = signaling.New(signaling.Options{@@ -283,6 +376,7 @@ func (m *Manager) Run(ctx context.Context) {m.log.Warn("局域网直连启动失败", "err", err)}}+ m.ApplyEveryone()go m.gcPending(ctx)go m.gateway.Run(ctx)go m.reconnectLoop(ctx)@@ -312,11 +406,17 @@ func (m *Manager) reconnectLoop(ctx context.Context) {defer t.Stop()features := time.NewTicker(time.Minute)defer features.Stop()+ idle := time.NewTicker(30 * time.Second)+ defer idle.Stop()for {select {case <-ctx.Done():return+ case <-idle.C:+ m.dropIdleOthers()+ m.forgetIdleStrangers()+ m.sendNotices()case <-t.C:m.connectPending(ctx)case <-features.C:@@ -383,14 +483,7 @@ const (FeatureSendFilesTCP = "send_files_tcp_v1")-func (m *Manager) featuresMessage() *pb.PeerMessage {- f := []string{FeatureSendFiles}- if m.loadConfig().ReceiveDisabled {- f = []string{FeatureSendFilesOff}- }- f = append(f, FeatureSendFilesTCP)- return &pb.PeerMessage{Payload: &pb.PeerMessage_Features{Features: &pb.PeerFeatures{Features: f, AppVersion: m.appVersion}}}-}+func (m *Manager) featuresMessage() *pb.PeerMessage { return m.featuresFor(RoleSelf) }func featureSet(names []string) map[string]bool {set := make(map[string]bool, len(names))@@ -405,10 +498,11 @@ func featureSet(names []string) map[string]bool {// BroadcastFeatures 在本机的功能开关变了以后(比如关掉了接收文件)告诉所有连着的设备。func (m *Manager) BroadcastFeatures() {- msg := m.featuresMessage()- for _, id := range m.pairedIDs() {+ for _, id := range m.lanPeerIDs() {if connected(m.p2p.State(id)) {- _ = m.p2p.Send(id, msg)+ if role := m.Role(id); role != "" {+ _ = m.p2p.Send(id, m.featuresFor(role))+ }}}}@@ -419,36 +513,48 @@ func (m *Manager) updatePeerFeatures(id string, f *pb.PeerFeatures) {if len(version) > 32 {version = version[:32]}+ names := make([]string, 0, len(set))+ for name := range set {+ names = append(names, name)+ }+ sort.Strings(names)m.mu.Lock()- _, ok := m.known[id]- if ok {+ role := m.roleLocked(id)+ if role != "" {m.features[id] = setm.peerVersion[id] = versionm.declared[id] = truedelete(m.legacy, id)}+ c, isFriend := m.contacts[id]+ if isFriend {+ c.Features, c.AppVersion = names, version+ m.contacts[id] = c+ }m.mu.Unlock()- if !ok {+ switch role {+ case "":return- }- names := make([]string, 0, len(set))- for name := range set {- names = append(names, name)- }- sort.Strings(names)- if err := m.store.SetDeviceFeatures(id, names, version); err != nil {- m.log.Warn("保存对端功能声明失败", "device", id, "err", err)+ case RoleSelf:+ if err := m.store.SetDeviceFeatures(id, names, version); err != nil {+ m.log.Warn("保存对端功能声明失败", "device", id, "err", err)+ }+ case RoleFriend:+ if err := m.store.PutContact(c); err != nil {+ m.log.Warn("保存好友的功能声明失败", "device", id, "err", err)+ }}if d, ok := m.device(id); ok {m.notify(d)}+ m.notifyFriend(id)}// checkLegacy 在连上 legacyWait 之后检查对端发过功能声明没有:// 还连着却一直没发,说明是不认识声明的旧版本。func (m *Manager) checkLegacy(id string) {m.mu.Lock()- _, ok := m.known[id]+ ok := m.roleLocked(id) != ""isLegacy := ok && connected(m.conn[id]) && !m.declared[id]if isLegacy {m.legacy[id] = true@@ -466,6 +572,7 @@ func (m *Manager) checkLegacy(id string) {if d, ok := m.device(id); ok {m.notify(d)}+ m.notifyFriend(id)}// SendFilesSupport 返回对端能不能接收隔空传送:supported 为 false 说明是旧版本(或者还没收到它的声明),@@ -528,6 +635,15 @@ func (m *Manager) publicKeyOf(deviceID string) ed25519.PublicKey {if d, ok := m.known[deviceID]; ok {return ed25519.PublicKey(d.PublicKey)}+ if c, ok := m.contacts[deviceID]; ok {+ return ed25519.PublicKey(c.PublicKey)+ }+ if c, ok := m.strangers[deviceID]; ok {+ return ed25519.PublicKey(c.PublicKey)+ }+ if key, ok := m.notices[deviceID]; ok {+ return ed25519.PublicKey(key)+ }for _, p := range m.pending {if p.peer.ID == deviceID {return ed25519.PublicKey(p.peer.PublicKey)@@ -539,10 +655,8 @@ func (m *Manager) publicKeyOf(deviceID string) ed25519.PublicKey {func (m *Manager) deviceInfo() (name, platform string, paired []string) {m.mu.RLock()defer m.mu.RUnlock()- ids := make([]string, 0, len(m.known))- for id := range m.known {- ids = append(ids, id)- }+ // 好友的在线状态也要服务器推送+ ids := m.watchIDsLocked()if m.loadConfig().UsesOfficialEndpoint() {return "PasteFerry " + m.identity.DeviceID[:8], "", ids}@@ -575,6 +689,12 @@ func (m *Manager) handlePresence(deviceID string, online bool) {if online {m.connectIfOffline(deviceID)+ m.mu.RLock()+ _, notice := m.notices[deviceID]+ m.mu.RUnlock()+ if notice {+ go m.sendNotices()+ }} else if !m.lan.Reachable(deviceID) {// 服务器说对方下线了,局域网里也找不到:连接多半已经失效m.p2p.Disconnect(deviceID)@@ -586,6 +706,7 @@ func (m *Manager) handlePresence(deviceID string, online bool) {if d, ok := m.device(deviceID); ok {m.notify(d)}+ m.notifyFriend(deviceID)m.notifyStatus() // 在线对端数随之变化}@@ -594,10 +715,17 @@ func (m *Manager) handlePresence(deviceID string, online bool) {func (m *Manager) handleLANReachable(deviceID string, reachable bool) {if reachable {m.connectIfOffline(deviceID)+ m.mu.RLock()+ _, notice := m.notices[deviceID]+ m.mu.RUnlock()+ if notice {+ go m.sendNotices()+ }}if d, ok := m.device(deviceID); ok {m.notify(d)}+ m.notifyFriend(deviceID)m.notifyStatus()}@@ -636,8 +764,24 @@ func (m *Manager) connectIfOffline(deviceID string) {}func (m *Manager) handleSignal(from string, msg *pb.SignalMessage) {+ // 加好友与删除好友的信令,不建立 P2P 连接+ switch p := msg.GetPayload().(type) {+ case *pb.SignalMessage_PairIntent:+ m.handlePairIntent(from, p.PairIntent)+ return+ case *pb.SignalMessage_FriendConfirm:+ m.handleFriendConfirm(from, p.FriendConfirm)+ return+ case *pb.SignalMessage_FriendRemove:+ m.handleFriendRemove(from, p.FriendRemove)+ return+ case *pb.SignalMessage_StrangerHello:+ return+ }+m.mu.RLock()- _, paired := m.known[from]+ role := m.roleLocked(from)+ paired := role != ""pendingPair := !paired && m.hasPendingLocked(from)m.mu.RUnlock()@@ -717,15 +861,21 @@ func (m *Manager) handleP2PState(deviceID string, state p2p.ConnState) {m.mu.Lock()prev := m.conn[deviceID]m.conn[deviceID] = state+ role := m.roleLocked(deviceID)if connected(state) && !connected(prev) {m.declared[deviceID] = false+ m.lastUse[deviceID] = time.Now()}m.mu.Unlock()if connected(state) && !connected(prev) {- cfg := m.loadConfig()- _ = m.p2p.Send(deviceID, &pb.PeerMessage{Payload: &pb.PeerMessage_Display{Display: &pb.PeerDisplay{Name: cfg.DeviceName, Platform: runtime.GOOS}}})+ if role == RoleSelf {+ cfg := m.loadConfig()+ _ = m.p2p.Send(deviceID, &pb.PeerMessage{Payload: &pb.PeerMessage_Display{Display: &pb.PeerDisplay{Name: cfg.DeviceName, Platform: runtime.GOOS}}})+ } else {+ _ = m.p2p.Send(deviceID, &pb.PeerMessage{Payload: &pb.PeerMessage_FriendCard{FriendCard: m.selfCard()}})+ }if !m.noFeatures {- _ = m.p2p.Send(deviceID, m.featuresMessage())+ _ = m.p2p.Send(deviceID, m.featuresFor(role))}time.AfterFunc(legacyWait, func() { m.checkLegacy(deviceID) })}@@ -734,9 +884,14 @@ func (m *Manager) handleP2PState(deviceID string, state p2p.ConnState) {if d, ok := m.device(deviceID); ok {m.notify(d)}+ m.notifyFriend(deviceID)// 直连与中转之间切换不算重新连上- if connected(state) && !connected(prev) && m.onPeerReady != nil {- m.onPeerReady(deviceID)+ if connected(state) && !connected(prev) {+ if role == RoleSelf && m.onPeerReady != nil {+ m.onPeerReady(deviceID)+ } else if role != RoleSelf && m.onOtherReady != nil {+ m.onOtherReady(deviceID)+ }}}@@ -831,15 +986,19 @@ func (m *Manager) handlePairingRedeemed(ev *pb.PairingRedeemed) {if a != nil {a.used = true}+ intent := lan.IntentDevice+ if a != nil && a.intent == lan.IntentFriend {+ intent = lan.IntentFriend+ }m.mu.Unlock()m.lan.ClosePairing()- _, _ = m.addPending(store.Device{+ _, _ = m.addPendingFor(store.Device{ID: ev.GetPeerDeviceId(),Name: ev.GetPeerDeviceName(),Platform: ev.GetPeerPlatform(),PublicKey: ev.GetPeerPublicKey(),- }, true, nil)+ }, true, nil, intent, "", nil)}// handlePairingResult:本机是兑换方,服务器回传了发起方信息。@@ -867,14 +1026,16 @@ func (m *Manager) acceptLANPair(peer lan.PeerInfo) bool {return false}a.used = true+ intent := a.intentm.mu.Unlock()- _, err := m.addPending(store.Device{+ // 局域网里用途不一致的请求已经在 lan 里回绝了,这里两边一致+ _, err := m.addPendingFor(store.Device{ID: peer.ID,Name: peer.Name,Platform: peer.Platform,PublicKey: peer.PublicKey,- }, true, peer.Addrs)+ }, true, peer.Addrs, intent, peer.Intent, peer.Card)return err == nil}@@ -903,29 +1064,56 @@ func (m *Manager) acceptNearby(peer lan.PeerInfo) bool {var ErrBadPeerID = errors.New("对方的设备 ID 与公钥不匹配")func (m *Manager) addPending(peer store.Device, initiated bool, addrs []string) (string, error) {+ // 局域网里「搜索附近设备」的配对:两边都是配对+ return m.addPendingFor(peer, initiated, addrs, lan.IntentDevice, lan.IntentDevice, nil)+}++// addPendingFor 记下一个待用户确认的配对或加好友。peerIntent 为空表示还不知道对方的用途+// (经服务器兑换的),之后用 PairIntent 信令交换。+func (m *Manager) addPendingFor(peer store.Device, initiated bool, addrs []string, intent, peerIntent string, peerCard *pb.FriendCard) (string, error) {// 校验对端 ID 确由其公钥派生,挡住服务器伪造的 device_idif !deviceid.Valid(peer.ID, peer.PublicKey) {m.log.Warn("拒绝配对:device_id 与公钥不匹配", "device", peer.ID)return "", ErrBadPeerID}+ if peer.ID == m.identity.DeviceID {+ return "", ErrBadPeerID+ }+ m.mu.RLock()+ role := m.roleLocked(peer.ID)+ m.mu.RUnlock()+ if intent == lan.IntentFriend && role == RoleSelf {+ return "", ErrAlreadyPaired+ }session := randomToken()- m.mu.Lock()- m.pending[session] = &pendingPair{- session: session,- peer: peer,- expiresAt: time.Now().Add(pendingTTL),- initiated: initiated,- addrs: addrs,+ p := &pendingPair{+ session: session,+ peer: peer,+ expiresAt: time.Now().Add(pendingTTL),+ initiated: initiated,+ addrs: addrs,+ intent: intent,+ peerIntent: peerIntent,+ peerCard: peerCard,+ intentKnown: make(chan struct{}),}+ m.mu.Lock()+ m.pending[session] = pm.mu.Unlock()m.log.Info("等待用户核对配对指纹",- "peer", peer.Name, "device", peer.ID,+ "peer", peer.Name, "device", peer.ID, "intent", intent,"fingerprint", deviceid.Fingerprint(peer.PublicKey))+ m.lan.PeersChanged()- // 发起方侧是被动收到的,主动推给 UI 让它弹出确认- if initiated {+ if peerIntent == "" {+ go m.exchangeIntent(session)+ } else {+ m.evaluateIntent(p)+ }+ // 配对的发起方侧是被动收到的,主动推给 UI 让它弹出确认;加好友等两边用途一致后再推(evaluateIntent)+ if initiated && intent == lan.IntentDevice {m.notify(m.toProto(peer, false, session))}return session, nil@@ -947,6 +1135,10 @@ var (// 连着服务器时用服务器签发的码,同一个码也在局域网里开放,两边谁先用掉算谁的;// 没连服务器时在本机生成,只在局域网里开放。func (m *Manager) CreatePairingCode(ctx context.Context) (string, time.Time, []string, error) {+ return m.createCode(ctx, lan.IntentDevice)+}++func (m *Manager) createCode(ctx context.Context, intent string) (string, time.Time, []string, error) {lanOn := m.lan.Running()var code stringvar expires time.Time@@ -972,10 +1164,14 @@ func (m *Manager) CreatePairingCode(ctx context.Context) (string, time.Time, []s}m.mu.Lock()- m.active = &activeCode{code: code, expires: expires}+ m.active = &activeCode{code: code, expires: expires, intent: intent}m.mu.Unlock()if lanOn {- m.lan.OpenPairing(code, expires)+ var card *pb.FriendCard+ if intent == lan.IntentFriend {+ card = m.selfCard()+ }+ m.lan.OpenPairingFor(code, expires, intent, card)}return code, expires, m.lan.DisplayAddrs(), nil}@@ -1007,7 +1203,10 @@ func (m *Manager) serverPairingCode(ctx context.Context) (string, time.Time, err// 先在局域网里找(address 是用户输入的对方地址,不在同一网段时用),// 找不到且连着服务器时再去服务器上兑换。func (m *Manager) RedeemPairingCode(ctx context.Context, code, address string) (*pb.Device, string, error) {- code = pairingcode.Normalize(code)+ code, friend := splitCode(code)+ if friend {+ return nil, "", ErrIsFriendCode+ }var extra []netip.AddrPortif address != "" {aps, err := lan.ResolveAddress(ctx, address)@@ -1034,6 +1233,9 @@ func (m *Manager) RedeemPairingCode(ctx context.Context, code, address string) (}return m.toProto(dev, false, session), session, nil}+ if errors.Is(err, lan.ErrIsFriendCode) {+ return nil, "", ErrIsFriendCode+ }lanErr = err}@@ -1053,6 +1255,22 @@ func (m *Manager) RedeemPairingCode(ctx context.Context, code, address string) (}func (m *Manager) redeemViaServer(ctx context.Context, code string) (*pb.Device, string, error) {+ session, err := m.redeemViaServerFor(ctx, code, lan.IntentDevice)+ if err != nil {+ return nil, "", err+ }+ m.mu.RLock()+ p := m.pending[session]+ m.mu.RUnlock()+ if p == nil {+ return nil, "", ErrSessionUnknown+ }+ return m.toProto(p.peer, false, session), session, nil+}++// redeemViaServerFor 经服务器兑换配对码或好友码,返回待确认的会话。+// 服务器不知道用途,之后两边用签名的 PairIntent 信令互相说明(见 exchangeIntent)+func (m *Manager) redeemViaServerFor(ctx context.Context, code, intent string) (string, error) {ch := make(chan redeemResult, 1)m.mu.Lock()m.redeemWaiters = append(m.redeemWaiters, ch)@@ -1070,12 +1288,12 @@ func (m *Manager) redeemViaServer(ctx context.Context, code string) (*pb.Device,if err := m.client.RedeemPairingCode(ctx, code); err != nil {drop()- return nil, "", err+ return "", err}select {case r := <-ch:if r.err != nil {- return nil, "", r.err+ return "", r.err}dev := store.Device{ID: r.ev.GetPeerDeviceId(),@@ -1083,17 +1301,13 @@ func (m *Manager) redeemViaServer(ctx context.Context, code string) (*pb.Device,Platform: r.ev.GetPeerPlatform(),PublicKey: r.ev.GetPeerPublicKey(),}- session, err := m.addPending(dev, false, nil)- if err != nil {- return nil, "", err- }- return m.toProto(dev, false, session), session, nil+ return m.addPendingFor(dev, false, nil, intent, "", nil)case <-ctx.Done():drop()- return nil, "", ctx.Err()+ return "", ctx.Err()case <-time.After(10 * time.Second):drop()- return nil, "", ErrCodeRejected+ return "", ErrCodeRejected}}@@ -1140,14 +1354,35 @@ func (m *Manager) PairNearby(ctx context.Context, id string) (*pb.Device, string// ConfirmPairing 在用户核对指纹后落库,正式建立互信。func (m *Manager) ConfirmPairing(ctx context.Context, session string, accept bool) error {- m.mu.Lock()+ // 经服务器兑换的还不知道对方的用途时,等它一会儿:对方开放的若是好友码,不能配成自己的设备。+ // 旧版本从不说明用途,等不到就当作配对+ m.mu.RLock()p, ok := m.pending[session]+ m.mu.RUnlock()+ if ok && accept && p.intent == lan.IntentDevice {+ select {+ case <-p.intentKnown:+ case <-time.After(intentConfirmWait):+ case <-ctx.Done():+ return ctx.Err()+ }+ }++ m.mu.Lock()+ p, ok = m.pending[session]+ if ok && p.intent == lan.IntentFriend {+ ok = false+ }if ok {delete(m.pending, session)}+ mismatch := m.mismatched[session]m.mu.Unlock()if !ok {+ if mismatch != nil {+ return mismatch+ }return ErrSessionUnknown}if !accept {@@ -1441,6 +1676,9 @@ func (m *Manager) gcPending(ctx context.Context) {delete(m.pending, k)}}+ if len(m.mismatched) > 64 {+ m.mismatched = make(map[string]error)+ }m.mu.Unlock()}}diff --git a/client-core/internal/peers/manager_test.go b/client-core/internal/peers/manager_test.goindex b3238eb..c8d56de 100644--- a/client-core/internal/peers/manager_test.go+++ b/client-core/internal/peers/manager_test.go@@ -7,6 +7,7 @@ import ("log/slog""net""net/http/httptest"+ "os""path/filepath""slices""strconv"@@ -63,7 +64,7 @@ func newDevice(t *testing.T, name string, net *lan.MemoryNetwork, cfg config.Cond.m, err = NewManager(Options{Identity: id,Store: db,- Logger: slog.New(slog.NewTextHandler(io.Discard, nil)),+ Logger: testLogger(name),LoadConfig: d.config,StatePath: filepath.Join(dir, "egress.json"),OnDeviceChanged: func(dev *pb.Device) {@@ -511,3 +512,11 @@ func TestLegacyPeerAfterWait(t *testing.T) {t.Fatalf("旧版本不该能收文件: %v", dev)}}++// testLogger 平时丢掉日志;设了 PF_TEST_LOG 时打到标准错误,排查用+func testLogger(name string) *slog.Logger {+ if os.Getenv("PF_TEST_LOG") == "" {+ return slog.New(slog.NewTextHandler(io.Discard, nil))+ }+ return slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug})).With("dev", name)+}diff --git a/client-core/internal/peers/strangers.go b/client-core/internal/peers/strangers.gonew file mode 100644index 0000000..92ec2f9--- /dev/null+++ b/client-core/internal/peers/strangers.go@@ -0,0 +1,182 @@+package peers++// 「所有人」模式下的陌生设备:只在局域网里,公钥只记在内存里。见 lan/stranger.go。++import (+ "context"+ "errors"+ "runtime"+ "strings"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/store"+ "github.com/baiyuze/pasteferry/client-core/internal/transport/lan"+ "github.com/baiyuze/pasteferry/proto/deviceid"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// StrangerPrefix 是界面上陌生设备的 ID 前缀:后面是它的 mDNS 实例名。发文件时先换成真正的设备 ID+const StrangerPrefix = "lan:"++var ErrStrangerGone = errors.New("对方不在附近,或者已经关掉了「所有人」")++// strangerKeep 是发送方记住陌生设备多久(没有再联系就忘掉)+const strangerKeep = 30 * time.Minute++// ApplyEveryone 按设置打开或关掉「所有人」:设置变了、到时间了都调一次。关掉时忘掉所有陌生设备+func (m *Manager) ApplyEveryone() {+ cfg := m.loadConfig()+ if cfg.EffectiveReceiveFrom(time.Now()) == config.ReceiveFromEveryone {+ card := m.selfCard()+ m.lan.ShowEveryone(card.GetDisplayName(), runtime.GOOS)+ return+ }+ m.lan.ShowEveryone("", "")+ m.mu.Lock()+ var gone []string+ for id, c := range m.strangers {+ // 本机主动联系过的(发送方这边)保留,对方开着「所有人」时还要用+ if c.Service != "outgoing" {+ gone = append(gone, id)+ delete(m.strangers, id)+ }+ }+ m.mu.Unlock()+ for _, id := range gone {+ m.p2p.Disconnect(id)+ m.mu.Lock()+ delete(m.conn, id)+ m.mu.Unlock()+ }+ if len(gone) > 0 {+ m.lan.PeersChanged()+ }+}++// acceptStranger:本机开着「所有人」,有陌生设备要给本机发文件。记下它的公钥,回本机的名片+func (m *Manager) acceptStranger(peer lan.PeerInfo) *pb.FriendCard {+ if !deviceid.Valid(peer.ID, peer.PublicKey) || peer.ID == m.identity.DeviceID {+ return nil+ }+ if m.loadConfig().EffectiveReceiveFrom(time.Now()) != config.ReceiveFromEveryone || m.store.IsBlocked(peer.ID) {+ return nil+ }+ m.mu.Lock()+ switch m.roleLocked(peer.ID) {+ case RoleSelf, RoleFriend:+ // 已经认识的,不当陌生设备+ default:+ card := cleanCard(peer.Card)+ m.strangers[peer.ID] = store.Contact{ID: peer.ID, PublicKey: peer.PublicKey, DisplayName: card.GetDisplayName(),+ DeviceName: card.GetDeviceName(), Platform: peer.Platform, AddedAt: time.Now()}+ m.lastUse[peer.ID] = time.Now()+ }+ m.mu.Unlock()+ m.lan.PeersChanged()+ return m.selfCard()+}++// ResolveStranger 把界面上的陌生设备(lan:实例名)换成设备 ID:向它要公钥和名片,记下来。+// 不是 lan: 开头的原样返回。+func (m *Manager) ResolveStranger(ctx context.Context, id string) (string, error) {+ inst, ok := strings.CutPrefix(id, StrangerPrefix)+ if !ok {+ return id, nil+ }+ lctx, cancel := context.WithTimeout(ctx, 5*time.Second)+ defer cancel()+ peer, err := m.lan.RequestStranger(lctx, inst, m.selfCard())+ if err != nil {+ return "", ErrStrangerGone+ }+ if !deviceid.Valid(peer.ID, peer.PublicKey) {+ return "", ErrBadPeerID+ }+ m.mu.Lock()+ if m.roleLocked(peer.ID) == "" {+ card := cleanCard(peer.Card)+ // Service 借来标记「本机主动联系的」,关掉本机的「所有人」时不删+ m.strangers[peer.ID] = store.Contact{ID: peer.ID, PublicKey: peer.PublicKey, DisplayName: card.GetDisplayName(),+ DeviceName: card.GetDeviceName(), Platform: peer.Platform, AddedAt: time.Now(), Service: "outgoing"}+ }+ m.lastUse[peer.ID] = time.Now()+ m.mu.Unlock()+ if len(peer.Addrs) > 0 {+ m.lan.Remember(peer.ID, peer.Addrs)+ }+ m.lan.PeersChanged()+ go m.ConnectFriend(peer.ID)+ return peer.ID, nil+}++// Stranger 返回认得的陌生设备+func (m *Manager) Stranger(id string) (*pb.Stranger, bool) {+ m.mu.RLock()+ defer m.mu.RUnlock()+ c, ok := m.strangers[id]+ if !ok {+ return nil, false+ }+ return &pb.Stranger{Id: c.ID, DisplayName: c.DisplayName, DeviceName: c.DeviceName, Platform: c.Platform, ReceivesFiles: true}, true+}++// WatchStrangers 在隔空传送页打开期间每 2 秒推一次附近开着「所有人」的陌生设备(有变化时)。+func (m *Manager) WatchStrangers(ctx context.Context, send func(*pb.Strangers) error) error {+ t := time.NewTicker(2 * time.Second)+ defer t.Stop()+ var last string+ for {+ list := &pb.Strangers{}+ var key strings.Builder+ for _, s := range m.lan.Strangers() {+ if s.PeerID != "" {+ continue // 自己的设备或好友,雷达上已经有了+ }+ list.Strangers = append(list.Strangers, &pb.Stranger{Id: StrangerPrefix + s.ID, DisplayName: s.Name, Platform: s.Platform, ReceivesFiles: true})+ key.WriteString(s.ID + "\x00" + s.Name + "\x00")+ }+ if k := key.String(); k != last || last == "" {+ last = k+ if k == "" {+ last = "\x01"+ }+ if err := send(list); err != nil {+ return err+ }+ }+ select {+ case <-ctx.Done():+ return nil+ case <-t.C:+ }+ }+}++// BlockDevice 屏蔽一台陌生设备:以后它的请求直接拒绝+func (m *Manager) BlockDevice(id string) error {+ if err := m.store.BlockDevice(id, time.Now()); err != nil {+ return err+ }+ m.mu.Lock()+ _, was := m.strangers[id]+ delete(m.strangers, id)+ m.mu.Unlock()+ if was {+ m.p2p.Disconnect(id)+ m.lan.PeersChanged()+ }+ return nil+}++// forgetIdleStrangers 忘掉很久没联系的陌生设备+func (m *Manager) forgetIdleStrangers() {+ now := time.Now()+ m.mu.Lock()+ defer m.mu.Unlock()+ for id := range m.strangers {+ if now.Sub(m.lastUse[id]) > strangerKeep && !connected(m.conn[id]) {+ delete(m.strangers, id)+ }+ }+}diff --git a/client-core/internal/profile/image.go b/client-core/internal/profile/image.gonew file mode 100644index 0000000..749804c--- /dev/null+++ b/client-core/internal/profile/image.go@@ -0,0 +1,178 @@+package profile++import (+ "bytes"+ "errors"+ "image"+ "image/color"+ _ "image/gif" // 注册 GIF 解码器+ "image/jpeg"+ "image/png"+ "io"+ "os"+ "path/filepath"+ "strings"++ "github.com/baiyuze/pasteferry/client-core/internal/imagepreview"+)++// 解码别人发来的图片只用 Go 自带的解码器(内存安全),界面只显示这里重新编码过的结果。+// 能解的:PNG、JPEG、GIF;HEIC、TIFF 在 Mac 上先由系统转成 PNG(imagepreview)。++// maxDecodePixels 是愿意解码的最大像素数,挡住「小文件、超大尺寸」的图片把内存撑爆+const maxDecodePixels = 64 << 20++var ErrNotImage = errors.New("不是能处理的图片")++// decodeLimited 先读尺寸,太大就不解+func decodeLimited(data []byte) (image.Image, error) {+ cfg, _, err := image.DecodeConfig(bytes.NewReader(data))+ if err != nil {+ return nil, ErrNotImage+ }+ if cfg.Width <= 0 || cfg.Height <= 0 || int64(cfg.Width)*int64(cfg.Height) > maxDecodePixels {+ return nil, ErrNotImage+ }+ img, _, err := image.Decode(bytes.NewReader(data))+ if err != nil {+ return nil, ErrNotImage+ }+ return img, nil+}++// readImageFile 读一张图片文件;Go 解不了的格式(HEIC 等)先让系统转成 PNG+func readImageFile(path string, limit int64) ([]byte, error) {+ if !imagepreview.Previewable(path) {+ return nil, ErrNotImage+ }+ src, err := imagepreview.Prepare(path)+ if err != nil {+ return nil, ErrNotImage+ }+ switch strings.ToLower(filepath.Ext(src)) {+ case ".png", ".jpg", ".jpeg", ".gif":+ default:+ return nil, ErrNotImage+ }+ f, err := os.Open(src)+ if err != nil {+ return nil, err+ }+ defer f.Close()+ data, err := io.ReadAll(io.LimitReader(f, limit+1))+ if err != nil {+ return nil, err+ }+ if int64(len(data)) > limit {+ return nil, ErrNotImage+ }+ return data, nil+}++// cropSquare 按比例裁出正方形:x、y、size 是 0 到 1;size 为 0 时取中间最大的正方形+func cropSquare(img image.Image, x, y, size float64) image.Rectangle {+ b := img.Bounds()+ w, h := b.Dx(), b.Dy()+ side := w+ if h < side {+ side = h+ }+ if size > 0 && size <= 1 {+ s := int(size * float64(max(w, h)))+ if s > 0 && s < side {+ side = s+ }+ }+ var x0, y0 int+ if size > 0 {+ x0, y0 = int(x*float64(w)), int(y*float64(h))+ } else {+ x0, y0 = (w-side)/2, (h-side)/2+ }+ x0 = min(max(x0, 0), w-side)+ y0 = min(max(y0, 0), h-side)+ return image.Rect(b.Min.X+x0, b.Min.Y+y0, b.Min.X+x0+side, b.Min.Y+y0+side)+}++// scale 把 src 里的 r 区域缩放到 w×h:缩小时按区域取平均(盒式滤波),放大时取最近的像素。+func scale(src image.Image, r image.Rectangle, w, h int) *image.RGBA {+ dst := image.NewRGBA(image.Rect(0, 0, w, h))+ sw, sh := r.Dx(), r.Dy()+ for dy := 0; dy < h; dy++ {+ y0 := r.Min.Y + dy*sh/h+ y1 := r.Min.Y + (dy+1)*sh/h+ if y1 <= y0 {+ y1 = y0 + 1+ }+ for dx := 0; dx < w; dx++ {+ x0 := r.Min.X + dx*sw/w+ x1 := r.Min.X + (dx+1)*sw/w+ if x1 <= x0 {+ x1 = x0 + 1+ }+ // 区域太大时隔几个取一个,缩略图看不出差别+ step := 1+ if n := (x1 - x0) * (y1 - y0); n > 64 {+ step = 2+ }+ var rs, gs, bs, as, n uint64+ for yy := y0; yy < y1; yy += step {+ for xx := x0; xx < x1; xx += step {+ cr, cg, cb, ca := src.At(xx, yy).RGBA()+ rs, gs, bs, as = rs+uint64(cr), gs+uint64(cg), bs+uint64(cb), as+uint64(ca)+ n+++ }+ }+ dst.SetRGBA(dx, dy, color.RGBA{uint8(rs / n >> 8), uint8(gs / n >> 8), uint8(bs / n >> 8), uint8(as / n >> 8)})+ }+ }+ return dst+}++// fitInside 是把 w×h 缩到长边不超过 limit 后的尺寸(不放大)+func fitInside(w, h, limit int) (int, int) {+ if w <= limit && h <= limit {+ return w, h+ }+ if w >= h {+ return limit, max(1, h*limit/w)+ }+ return max(1, w*limit/h), limit+}++// onWhite 把透明的部分垫上白色(JPEG 没有透明)+func onWhite(img *image.RGBA) *image.RGBA {+ for i := 0; i+3 < len(img.Pix); i += 4 {+ a := uint32(img.Pix[i+3])+ if a == 255 {+ continue+ }+ for c := 0; c < 3; c++ {+ img.Pix[i+c] = uint8((uint32(img.Pix[i+c])*a + 255*(255-a)) / 255)+ }+ img.Pix[i+3] = 255+ }+ return img+}++// encodeJPEG 编码成不超过 limit 字节的 JPEG,质量从高往低试+func encodeJPEG(img image.Image, limit int) ([]byte, error) {+ for _, q := range []int{88, 80, 70, 60, 50, 40} {+ var buf bytes.Buffer+ if err := jpeg.Encode(&buf, img, &jpeg.Options{Quality: q}); err != nil {+ return nil, err+ }+ if buf.Len() <= limit {+ return buf.Bytes(), nil+ }+ }+ return nil, errors.New("图片压不到大小上限以内")+}++func encodePNG(img image.Image) ([]byte, error) {+ var buf bytes.Buffer+ if err := png.Encode(&buf, img); err != nil {+ return nil, err+ }+ return buf.Bytes(), nil+}diff --git a/client-core/internal/profile/profile.go b/client-core/internal/profile/profile.gonew file mode 100644index 0000000..b295a20--- /dev/null+++ b/client-core/internal/profile/profile.go@@ -0,0 +1,250 @@+// Package profile 是好友看到的本机信息:显示名和头像,以及好友发来的头像、收到的图片的缩略图。+// 见 design/friends-send.md 第 4.3、4.4、6.3 节。+package profile++import (+ "crypto/sha256"+ "encoding/hex"+ "errors"+ "fmt"+ "os"+ "os/user"+ "path/filepath"+ "runtime"+ "strings"+ "sync"+ "time"+ "unicode/utf8"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/peers"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++const (+ // AvatarSize 是头像的边长,MaxAvatar 是头像 JPEG 最大多大+ AvatarSize = 256+ MaxAvatar = 64 << 10+ // 头像的原图、收到的图片最多读多大+ maxSourceBytes = 64 << 20+ // thumbSize 是缩略图的长边+ thumbSize = 320+ // thumbKeep 是缩略图保留多久(传输记录也是 30 天)+ thumbKeep = 31 * 24 * time.Hour+)++var ErrBadName = errors.New("名字太长或有不能用的字符")++type Profile struct {+ root string // 数据目录+ load func() config.Config+ save func(config.Config) error++ mu sync.Mutex+}++func New(root string, load func() config.Config, save func(config.Config) error) *Profile {+ return &Profile{root: root, load: load, save: save}+}++func (p *Profile) avatarPath() string { return filepath.Join(p.root, "avatar.jpg") }+func (p *Profile) friendsDir() string { return filepath.Join(p.root, "avatars") }+func (p *Profile) thumbsDir() string { return filepath.Join(p.root, "thumbs") }++// DefaultName 是系统的用户全名,取不到时用登录名。+func DefaultName() string {+ u, err := user.Current()+ if err != nil {+ return ""+ }+ name := strings.TrimSpace(u.Name)+ // Windows 上可能是「域\用户」+ if i := strings.LastIndex(name, `\`); i >= 0 {+ name = name[i+1:]+ }+ // Linux 的 GECOS 是逗号分隔的几项,第一项是全名+ if i := strings.Index(name, ","); i >= 0 {+ name = name[:i]+ }+ if name == "" {+ name = u.Username+ if i := strings.LastIndex(name, `\`); i >= 0 {+ name = name[i+1:]+ }+ }+ return name+}++// DisplayName 是好友看到的名字:设置过的,或者系统的用户全名+func (p *Profile) DisplayName() string {+ if n := strings.TrimSpace(p.load().DisplayName); n != "" {+ return n+ }+ if n := DefaultName(); n != "" {+ return n+ }+ return p.load().DeviceName+}++// SetDisplayName 改名字;空字符串表示恢复成系统的用户全名+func (p *Profile) SetDisplayName(name string) error {+ name = strings.TrimSpace(name)+ if !utf8.ValidString(name) || utf8.RuneCountInString(name) > 32 || strings.ContainsFunc(name, func(r rune) bool { return r < 0x20 || r == 0x7f }) {+ return ErrBadName+ }+ c := p.load()+ c.DisplayName = name+ return p.save(c)+}++// Avatar 返回本机头像(JPEG),没有设置时为空+func (p *Profile) Avatar() []byte {+ data, err := os.ReadFile(p.avatarPath())+ if err != nil || len(data) > MaxAvatar {+ return nil+ }+ return data+}++// SetAvatar 把一张图片裁成正方形、缩到 256×256、编码成不超过 64 KB 的 JPEG 存下来。+// 重新编码会去掉 EXIF 等元数据(拍摄地点不会发给别人)。data 为空时读 path+func (p *Profile) SetAvatar(data []byte, path string, x, y, size float64) error {+ if len(data) == 0 {+ var err error+ if data, err = readImageFile(path, maxSourceBytes); err != nil {+ return err+ }+ }+ if len(data) > maxSourceBytes {+ return ErrNotImage+ }+ img, err := decodeLimited(data)+ if err != nil {+ return err+ }+ r := cropSquare(img, x, y, size)+ out, err := encodeJPEG(onWhite(scale(img, r, AvatarSize, AvatarSize)), MaxAvatar)+ if err != nil {+ return err+ }+ p.mu.Lock()+ defer p.mu.Unlock()+ return writeAtomic(p.avatarPath(), out)+}++func (p *Profile) ResetAvatar() error {+ err := os.Remove(p.avatarPath())+ if errors.Is(err, os.ErrNotExist) {+ return nil+ }+ return err+}++// Card 是发给好友的名片+func (p *Profile) Card() *pb.FriendCard {+ cfg := p.load()+ service := "lan"+ var hash []byte+ switch {+ case cfg.Official():+ service = "official"+ case cfg.EffectiveSignalingURL() != "":+ service = "custom"+ hash = peers.ServiceHash(cfg.EffectiveSignalingURL())+ }+ return &pb.FriendCard{+ DisplayName: p.DisplayName(),+ DeviceName: cfg.DeviceName,+ Platform: runtime.GOOS,+ Service: service,+ CustomServerHash: hash,+ AvatarHash: peers.AvatarHash(p.Avatar()),+ }+}++func (p *Profile) Proto(deviceID string) *pb.Profile {+ avatar := p.Avatar()+ return &pb.Profile{DisplayName: p.DisplayName(), DeviceId: deviceID, HasAvatar: len(avatar) > 0, AvatarHash: peers.AvatarHash(avatar)}+}++// SaveFriendAvatar 把好友发来的头像重新解码、编码后存下,返回存放的路径。+func (p *Profile) SaveFriendAvatar(deviceID string, jpeg []byte) (string, error) {+ if len(jpeg) > MaxAvatar || strings.ContainsAny(deviceID, `/\.`) || deviceID == "" {+ return "", ErrNotImage+ }+ img, err := decodeLimited(jpeg)+ if err != nil {+ return "", err+ }+ b := img.Bounds()+ w, h := fitInside(b.Dx(), b.Dy(), AvatarSize)+ out, err := encodeJPEG(onWhite(scale(img, b, w, h)), MaxAvatar)+ if err != nil {+ return "", err+ }+ path := filepath.Join(p.friendsDir(), deviceID+".jpg")+ if err := writeAtomic(path, out); err != nil {+ return "", err+ }+ return path, nil+}++// FriendAvatar 读好友的头像(已经是重新编码过的)+func (p *Profile) FriendAvatar(path string) []byte {+ if path == "" || filepath.Dir(path) != p.friendsDir() {+ return nil+ }+ data, err := os.ReadFile(path)+ if err != nil || len(data) > MaxAvatar {+ return nil+ }+ return data+}++// Thumbnail 为收到的一张图片生成缩略图(PNG),返回路径;不是能处理的图片时为空。+func (p *Profile) Thumbnail(path string) string {+ data, err := readImageFile(path, maxSourceBytes)+ if err != nil {+ return ""+ }+ img, err := decodeLimited(data)+ if err != nil {+ return ""+ }+ b := img.Bounds()+ w, h := fitInside(b.Dx(), b.Dy(), thumbSize)+ out, err := encodePNG(scale(img, b, w, h))+ if err != nil {+ return ""+ }+ sum := sha256.Sum256([]byte(fmt.Sprintf("%s|%d", path, time.Now().UnixNano())))+ dst := filepath.Join(p.thumbsDir(), hex.EncodeToString(sum[:10])+".png")+ if err := writeAtomic(dst, out); err != nil {+ return ""+ }+ return dst+}++// CleanThumbs 删掉过期的缩略图+func (p *Profile) CleanThumbs() {+ entries, err := os.ReadDir(p.thumbsDir())+ if err != nil {+ return+ }+ for _, e := range entries {+ if info, err := e.Info(); err == nil && time.Since(info.ModTime()) > thumbKeep {+ _ = os.Remove(filepath.Join(p.thumbsDir(), e.Name()))+ }+ }+}++func writeAtomic(path string, data []byte) error {+ if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {+ return err+ }+ tmp := path + ".tmp"+ if err := os.WriteFile(tmp, data, 0o600); err != nil {+ return err+ }+ return os.Rename(tmp, path)+}diff --git a/client-core/internal/profile/profile_test.go b/client-core/internal/profile/profile_test.gonew file mode 100644index 0000000..9027b98--- /dev/null+++ b/client-core/internal/profile/profile_test.go@@ -0,0 +1,128 @@+package profile++import (+ "bytes"+ "image"+ "image/color"+ "image/jpeg"+ "image/png"+ "os"+ "path/filepath"+ "testing"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+)++func newProfile(t *testing.T) (*Profile, *config.Config) {+ t.Helper()+ cfg := config.Default()+ p := New(t.TempDir(), func() config.Config { return cfg }, func(c config.Config) error { cfg = c; return nil })+ return p, &cfg+}++func testImage(w, h int) []byte {+ img := image.NewRGBA(image.Rect(0, 0, w, h))+ for y := 0; y < h; y++ {+ for x := 0; x < w; x++ {+ img.Set(x, y, color.RGBA{uint8(x), uint8(y), 128, 255})+ }+ }+ var buf bytes.Buffer+ _ = png.Encode(&buf, img)+ return buf.Bytes()+}++func TestDisplayName(t *testing.T) {+ p, cfg := newProfile(t)+ if p.DisplayName() == "" {+ t.Fatal("没设置时应当用系统的用户名")+ }+ if err := p.SetDisplayName(" 光光 "); err != nil {+ t.Fatal(err)+ }+ if p.DisplayName() != "光光" || cfg.DisplayName != "光光" {+ t.Fatalf("名字不对: %q", p.DisplayName())+ }+ if err := p.SetDisplayName("a\nb"); err != ErrBadName {+ t.Fatalf("有换行的名字应当被拒: %v", err)+ }+ if err := p.SetDisplayName(string(bytes.Repeat([]byte("长"), 33))); err != ErrBadName {+ t.Fatalf("太长的名字应当被拒: %v", err)+ }+}++func TestAvatar(t *testing.T) {+ p, _ := newProfile(t)+ if p.Avatar() != nil {+ t.Fatal("一开始没有头像")+ }+ if err := p.SetAvatar(testImage(1200, 800), "", 0, 0, 0); err != nil {+ t.Fatal(err)+ }+ data := p.Avatar()+ if len(data) == 0 || len(data) > MaxAvatar {+ t.Fatalf("头像大小不对: %d", len(data))+ }+ img, err := jpeg.Decode(bytes.NewReader(data))+ if err != nil {+ t.Fatal(err)+ }+ if b := img.Bounds(); b.Dx() != AvatarSize || b.Dy() != AvatarSize {+ t.Fatalf("头像应当是 %d×%d,得到 %v", AvatarSize, AvatarSize, b)+ }+ if card := p.Card(); len(card.GetAvatarHash()) == 0 {+ t.Fatal("名片里应当有头像的哈希")+ }+ if err := p.SetAvatar([]byte("不是图片"), "", 0, 0, 0); err != ErrNotImage {+ t.Fatalf("不是图片应当被拒: %v", err)+ }+ if err := p.ResetAvatar(); err != nil || p.Avatar() != nil {+ t.Fatalf("恢复默认头像: %v", err)+ }+}++func TestFriendAvatarAndThumbnail(t *testing.T) {+ p, _ := newProfile(t)+ if err := p.SetAvatar(testImage(300, 300), "", 0, 0, 0); err != nil {+ t.Fatal(err)+ }+ path, err := p.SaveFriendAvatar("abc", p.Avatar())+ if err != nil {+ t.Fatal(err)+ }+ if len(p.FriendAvatar(path)) == 0 {+ t.Fatal("读不回好友的头像")+ }+ if p.FriendAvatar("/etc/passwd") != nil {+ t.Fatal("只能读头像目录里的文件")+ }+ if _, err := p.SaveFriendAvatar("../x", p.Avatar()); err == nil {+ t.Fatal("设备 ID 里有路径时应当拒绝")+ }+ if _, err := p.SaveFriendAvatar("abc", []byte("坏数据")); err == nil {+ t.Fatal("坏数据应当拒绝")+ }++ img := filepath.Join(t.TempDir(), "照片.png")+ if err := os.WriteFile(img, testImage(1000, 500), 0o600); err != nil {+ t.Fatal(err)+ }+ thumb := p.Thumbnail(img)+ if thumb == "" {+ t.Fatal("没生成缩略图")+ }+ f, err := os.Open(thumb)+ if err != nil {+ t.Fatal(err)+ }+ defer f.Close()+ cfg, err := png.DecodeConfig(f)+ if err != nil || cfg.Width != thumbSize || cfg.Height != thumbSize/2 {+ t.Fatalf("缩略图尺寸不对: %v %v", cfg, err)+ }+ txt := filepath.Join(t.TempDir(), "a.txt")+ _ = os.WriteFile(txt, []byte("x"), 0o600)+ if p.Thumbnail(txt) != "" {+ t.Fatal("不是图片不该有缩略图")+ }+}diff --git a/client-core/internal/rpc/convert.go b/client-core/internal/rpc/convert.goindex 9e03484..afdd53b 100644--- a/client-core/internal/rpc/convert.go+++ b/client-core/internal/rpc/convert.go@@ -92,9 +92,17 @@ func configToProto(c config.Config) *pb.Config {RealtimeSyncDisabled: c.RealtimeSyncDisabled,SyncBacklog: c.SyncBacklog,SyncDisabledPeers: append([]string(nil), c.SyncDisabledPeers...),+ ReceiveFrom: receiveFromToProto(c),+ EveryoneUntilUnix: c.EveryoneUntil,+ DisplayName: c.DisplayName,}}+// receiveFromToProto 报告此刻实际的接收范围:「所有人」到时间了就是「仅限好友」+func receiveFromToProto(c config.Config) string {+ return c.EffectiveReceiveFrom(time.Now())+}+// configFromProto 以 base 打底再覆盖,这样 UI 只改动部分字段时// 不会把没填的字段清零(proto3 无法区分"未设置"与"零值")。func configFromProto(in *pb.Config, base config.Config) config.Config {@@ -170,6 +178,17 @@ func configFromProto(in *pb.Config, base config.Config) config.Config {c.ReceiveDisabled = in.GetReceiveDisabled()c.ReceiveNotifyDisabled = in.GetReceiveNotifyDisabled()c.SendLayoutStacked = in.GetSendLayoutStacked()+ // 旧界面不带这一项,不改。打开「所有人」时从现在起算 10 分钟;显示名由 SetDisplayName 改,这里不动+ if from := in.GetReceiveFrom(); from != "" {+ wasEveryone := base.EffectiveReceiveFrom(time.Now()) == config.ReceiveFromEveryone+ c.ReceiveFrom = from+ switch {+ case from != config.ReceiveFromEveryone:+ c.EveryoneUntil = 0+ case !wasEveryone:+ c.EveryoneUntil = time.Now().Add(config.EveryoneWindow).Unix()+ }+ }return c}diff --git a/client-core/internal/rpc/friends.go b/client-core/internal/rpc/friends.gonew file mode 100644index 0000000..4c8ecf0--- /dev/null+++ b/client-core/internal/rpc/friends.go@@ -0,0 +1,224 @@+package rpc++import (+ "context"+ "errors"+ "time"++ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"++ "github.com/baiyuze/pasteferry/client-core/internal/peers"+ "github.com/baiyuze/pasteferry/client-core/internal/profile"+ "github.com/baiyuze/pasteferry/client-core/internal/send"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// Friends 是好友,见 design/friends-send.md。由 daemon 把 peers.Manager 与 profile.Profile 拼起来提供。+type Friends interface {+ Profile() *pb.Profile+ SetDisplayName(name string) (*pb.Profile, error)+ SetAvatar(req *pb.SetAvatarRequest) (*pb.Profile, error)+ ResetAvatar() (*pb.Profile, error)+ Avatar(deviceID string) *pb.Avatar+ CreateFriendCode(ctx context.Context) (code string, expiresAt time.Time, lanAddrs []string, err error)+ RedeemFriendCode(ctx context.Context, code, address string) (*pb.FriendRequest, error)+ ConfirmFriend(ctx context.Context, session string, accept bool) error+ Friends() []*pb.Friend+ RemoveFriend(ctx context.Context, deviceID string) error+ SetFriendAutoAccept(deviceID string, auto bool) (*pb.Friend, error)+ BlockDevice(deviceID string) error+ WatchStrangers(ctx context.Context, send func(*pb.Strangers) error) error+}++func EventFriendChanged(f *pb.Friend) *pb.Event {+ return &pb.Event{Payload: &pb.Event_FriendChanged{FriendChanged: f}}+}++func EventFriendRemoved(id string) *pb.Event {+ return &pb.Event{Payload: &pb.Event_FriendRemoved{FriendRemoved: id}}+}++func EventFriendRequest(r *pb.FriendRequest) *pb.Event {+ return &pb.Event{Payload: &pb.Event_FriendRequest{FriendRequest: r}}+}++func EventProfileChanged(p *pb.Profile) *pb.Event {+ return &pb.Event{Payload: &pb.Event_ProfileChanged{ProfileChanged: p}}+}++func (s *Server) friends() (Friends, error) {+ if s.deps.Friends == nil {+ return nil, status.Error(codes.Unimplemented, "好友不可用")+ }+ return s.deps.Friends, nil+}++// friendError 把好友相关的错误转成状态码。加好友的错误与配对的相同(「原因: 说明」),界面按原因显示文案+func friendError(err error) error {+ switch {+ case errors.Is(err, peers.ErrNotFriend), errors.Is(err, peers.ErrSessionUnknown):+ return status.Error(codes.NotFound, err.Error())+ case errors.Is(err, profile.ErrBadName), errors.Is(err, profile.ErrNotImage):+ return status.Error(codes.InvalidArgument, err.Error())+ }+ return pairingStatus(err)+}++func (s *Server) GetProfile(context.Context, *pb.Empty) (*pb.Profile, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ return f.Profile(), nil+}++func (s *Server) SetDisplayName(_ context.Context, req *pb.SetDisplayNameRequest) (*pb.Profile, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ p, err := f.SetDisplayName(req.GetName())+ if err != nil {+ return nil, friendError(err)+ }+ return p, nil+}++func (s *Server) SetAvatar(_ context.Context, req *pb.SetAvatarRequest) (*pb.Profile, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ p, err := f.SetAvatar(req)+ if err != nil {+ return nil, friendError(err)+ }+ return p, nil+}++func (s *Server) ResetAvatar(context.Context, *pb.Empty) (*pb.Profile, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ p, err := f.ResetAvatar()+ if err != nil {+ return nil, friendError(err)+ }+ return p, nil+}++func (s *Server) GetAvatar(_ context.Context, req *pb.GetAvatarRequest) (*pb.Avatar, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ return f.Avatar(req.GetDeviceId()), nil+}++func (s *Server) CreateFriendCode(ctx context.Context, _ *pb.Empty) (*pb.CreatePairingCodeResponse, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ code, expires, addrs, err := f.CreateFriendCode(ctx)+ if err != nil {+ return nil, friendError(err)+ }+ return &pb.CreatePairingCodeResponse{Code: code, ExpiresAtUnix: expires.Unix(), LanAddresses: addrs}, nil+}++func (s *Server) RedeemFriendCode(ctx context.Context, req *pb.RedeemPairingCodeRequest) (*pb.FriendRequest, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ r, err := f.RedeemFriendCode(ctx, req.GetCode(), req.GetAddress())+ if err != nil {+ return nil, friendError(err)+ }+ return r, nil+}++func (s *Server) ConfirmFriend(ctx context.Context, req *pb.ConfirmPairingRequest) (*pb.Empty, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ if err := f.ConfirmFriend(ctx, req.GetPairingSession(), req.GetAccept()); err != nil {+ return nil, friendError(err)+ }+ return &pb.Empty{}, nil+}++func (s *Server) ListFriends(context.Context, *pb.Empty) (*pb.ListFriendsResponse, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ return &pb.ListFriendsResponse{Friends: f.Friends()}, nil+}++func (s *Server) RemoveFriend(ctx context.Context, req *pb.FriendRef) (*pb.Empty, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ if err := f.RemoveFriend(ctx, req.GetDeviceId()); err != nil {+ return nil, friendError(err)+ }+ return &pb.Empty{}, nil+}++func (s *Server) SetFriendAutoAccept(_ context.Context, req *pb.SetFriendAutoAcceptRequest) (*pb.Friend, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ out, err := f.SetFriendAutoAccept(req.GetDeviceId(), req.GetAutoAccept())+ if err != nil {+ return nil, friendError(err)+ }+ return out, nil+}++func (s *Server) BlockDevice(_ context.Context, req *pb.FriendRef) (*pb.Empty, error) {+ f, err := s.friends()+ if err != nil {+ return nil, err+ }+ if err := f.BlockDevice(req.GetDeviceId()); err != nil {+ return nil, friendError(err)+ }+ return &pb.Empty{}, nil+}++func (s *Server) WatchStrangers(_ *pb.Empty, stream pb.DaemonService_WatchStrangersServer) error {+ f, err := s.friends()+ if err != nil {+ return err+ }+ return f.WatchStrangers(stream.Context(), stream.Send)+}++// AnswerIncoming 是接收弹窗里的「接受」「拒绝」;勾了「以后自动接收」时对这个好友打开自动接收+func (s *Server) AnswerIncoming(_ context.Context, req *pb.AnswerIncomingRequest) (*pb.Empty, error) {+ t, err := s.transfers()+ if err != nil {+ return nil, err+ }+ deviceID, role, err := t.Answer(req.GetTransferId(), req.GetAccept())+ if err != nil {+ if errors.Is(err, send.ErrNotAsking) {+ return nil, status.Error(codes.FailedPrecondition, err.Error())+ }+ return nil, transferError(err)+ }+ if req.GetAccept() && req.GetAlways() && role == peers.RoleFriend && s.deps.Friends != nil {+ if _, err := s.deps.Friends.SetFriendAutoAccept(deviceID, true); err != nil {+ return nil, friendError(err)+ }+ }+ return &pb.Empty{}, nil+}diff --git a/client-core/internal/rpc/send.go b/client-core/internal/rpc/send.goindex 6727aa4..29e4c64 100644--- a/client-core/internal/rpc/send.go+++ b/client-core/internal/rpc/send.go@@ -14,7 +14,9 @@ import (// Transfers 是隔空传送,见 internal/send。type Transfers interface {- SendFiles(deviceID string, paths []string, allowRelay bool) (*pb.Transfer, error)+ SendFiles(deviceID string, paths []string, allowRelay bool, note string) (*pb.Transfer, error)+ // Answer 是本机用户接受或拒绝别人发来的一批,返回发来的设备与它的角色+ Answer(id string, accept bool) (deviceID, role string, err error)Cancel(id string) errorResume(id string) errorList(dir pb.TransferDirection, limit int, before time.Time) ([]*pb.Transfer, error)@@ -34,8 +36,8 @@ func EventTransferRemoved(id string) *pb.Event {// transferError 把隔空传送的错误转成状态码;消息是固定代码,界面按它显示文案。func transferError(err error) error {switch {- case errors.Is(err, send.ErrNoPaths):- return status.Error(codes.InvalidArgument, send.ErrNoPaths.Error())+ case errors.Is(err, send.ErrNoPaths), errors.Is(err, send.ErrBadNote):+ return status.Error(codes.InvalidArgument, err.Error())case errors.Is(err, send.ErrNotFound), errors.Is(err, send.ErrUnknownDevice):return status.Error(codes.NotFound, err.Error())case errors.Is(err, send.ErrOffline), errors.Is(err, send.ErrUnsupported), errors.Is(err, send.ErrPeerDisabled),@@ -57,7 +59,7 @@ func (s *Server) SendFiles(_ context.Context, req *pb.SendFilesRequest) (*pb.Traif err != nil {return nil, err}- out, err := t.SendFiles(req.GetDeviceId(), req.GetPaths(), req.GetAllowRelay())+ out, err := t.SendFiles(req.GetDeviceId(), req.GetPaths(), req.GetAllowRelay(), req.GetNote())if err != nil {return nil, transferError(err)}diff --git a/client-core/internal/rpc/server.go b/client-core/internal/rpc/server.goindex bf4d123..f41c52f 100644--- a/client-core/internal/rpc/server.go+++ b/client-core/internal/rpc/server.go@@ -96,6 +96,8 @@ type Deps struct {// Transfers 是隔空传送;为 nil 时相应的方法返回 UnimplementedTransfers Transfers+ // Friends 是好友(2.6.0);为 nil 时相应的方法返回 Unimplemented+ Friends Friends}func (s *Server) GetNotificationStatus(ctx context.Context, _ *pb.Empty) (*pb.NotificationStatus, error) {@@ -554,6 +556,15 @@ func pairingStatus(err error) error {reason, code = "bad_address", codes.InvalidArgumentcase errors.Is(err, peers.ErrNoChannel), errors.Is(err, lan.ErrDisabled):reason, code = "no_channel", codes.FailedPrecondition+ // 好友(2.6.0):码的用途不对、对方版本太旧、已经是自己的设备+ case errors.Is(err, peers.ErrIsFriendCode):+ reason, code = "friend_code", codes.FailedPrecondition+ case errors.Is(err, peers.ErrIsDeviceCode):+ reason, code = "device_code", codes.FailedPrecondition+ case errors.Is(err, peers.ErrPeerOutdated):+ reason, code = "peer_outdated", codes.FailedPrecondition+ case errors.Is(err, peers.ErrAlreadyPaired):+ reason, code = "already_paired", codes.FailedPrecondition}if reason == "" {return status.Error(code, err.Error())@@ -598,6 +609,9 @@ func (s *Server) ConfirmPairing(ctx context.Context, req *pb.ConfirmPairingRequereturn nil, status.Error(codes.Unimplemented, "配对尚未接入(M1)")}if err := s.deps.ConfirmPairing(ctx, req.GetPairingSession(), req.GetAccept()); err != nil {+ if errors.Is(err, peers.ErrIsFriendCode) {+ return nil, pairingStatus(err)+ }return nil, status.Errorf(codes.Internal, "确认配对: %v", err)}return &pb.Empty{}, nildiff --git a/client-core/internal/send/ask.go b/client-core/internal/send/ask.gonew file mode 100644index 0000000..2a16332--- /dev/null+++ b/client-core/internal/send/ask.go@@ -0,0 +1,193 @@+package send++// 好友与陌生设备发来的文件要本机的用户点「接受」(2.6.0),见 design/friends-send.md 第 7 节。+// 接收方先回 SendAnswer{reason: "pending"},用户决定后再回最终结果;60 秒没有回应算拒绝。++import (+ "strings"+ "time"+ "unicode"+ "unicode/utf8"++ "github.com/baiyuze/pasteferry/client-core/internal/store"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// 用户的决定+const (+ askAccept = "accept"+ askDeclined = "declined"+ askCancelled = "cancelled" // 发送方取消了+)++// CleanNote 检查备注:最多 MaxNote 个字符、一行、没有控制字符。两头的空白去掉。+func CleanNote(note string) (string, bool) {+ note = strings.TrimSpace(note)+ if !utf8.ValidString(note) || utf8.RuneCountInString(note) > MaxNote {+ return "", false+ }+ for _, r := range note {+ if unicode.IsControl(r) || r == ' ' || r == ' ' {+ return "", false+ }+ }+ return note, true+}++// askUser 记下一批等用户接受的,通知界面,等用户的决定、发送方取消或超时。+// 返回 askAccept、askDeclined、askCancelled 或 "timeout"。+func (e *Engine) askUser(t store.Transfer) string {+ ch := make(chan string, 1)+ e.mu.Lock()+ e.asks[t.ID] = ch+ e.mu.Unlock()+ defer func() {+ e.mu.Lock()+ delete(e.asks, t.ID)+ e.mu.Unlock()+ }()+ e.save(t)+ e.notice(NoticeAsk, t)+ timer := time.NewTimer(e.opts.AskTimeout)+ defer timer.Stop()+ select {+ case d := <-ch:+ return d+ case <-timer.C:+ return "timeout"+ case <-e.ctx.Done():+ return askCancelled+ }+}++// Answer 是用户在接收弹窗里点了「接受」或「拒绝」。返回发来的设备和它的角色(「以后自动接收」用)。+func (e *Engine) Answer(id string, accept bool) (deviceID, role string, err error) {+ e.mu.Lock()+ ch := e.asks[id]+ e.mu.Unlock()+ if ch == nil {+ return "", "", ErrNotAsking+ }+ t, err := e.opts.Store.GetTransfer(id)+ if err != nil {+ return "", "", ErrNotFound+ }+ d := askDeclined+ if accept {+ d = askAccept+ }+ select {+ case ch <- d:+ default:+ }+ return t.DeviceID, t.PeerRole, nil+}++// cancelAsk:发送方在本机用户决定之前取消了。返回 false 表示这一批不在等用户+func (e *Engine) cancelAsk(id, from string) bool {+ e.mu.Lock()+ ch := e.asks[id]+ e.mu.Unlock()+ if ch == nil {+ return false+ }+ if t, err := e.opts.Store.GetTransfer(id); err != nil || t.DeviceID != from {+ return false+ }+ select {+ case ch <- askCancelled:+ default:+ }+ return true+}++// declined 记下用户拒绝了这台电脑一次;一分钟内拒绝 3 次,之后 10 分钟它的请求直接拒绝+func (e *Engine) declined(from string) {+ now := e.opts.Now()+ e.mu.Lock()+ defer e.mu.Unlock()+ recent := e.declines[from][:0]+ for _, at := range e.declines[from] {+ if now.Sub(at) < declineWindow {+ recent = append(recent, at)+ }+ }+ recent = append(recent, now)+ e.declines[from] = recent+ if len(recent) >= declineLimit {+ e.muted[from] = now.Add(declineMute)+ delete(e.declines, from)+ e.log.Info("一分钟内拒绝了 3 次,10 分钟内不再提示", "device", from)+ }+}++func (e *Engine) isMuted(from string) bool {+ e.mu.Lock()+ defer e.mu.Unlock()+ until, ok := e.muted[from]+ if !ok {+ return false+ }+ if e.opts.Now().After(until) {+ delete(e.muted, from)+ return false+ }+ return true+}++// Busy 报告与某台电脑之间是否还有传输在进行或等待(好友的连接空闲时才断开)+func (e *Engine) Busy(deviceID string) bool {+ e.mu.Lock()+ defer e.mu.Unlock()+ for _, o := range e.out {+ if o.device == deviceID {+ return true+ }+ }+ for _, in := range e.in {+ if in.device == deviceID {+ return true+ }+ }+ if e.workers[deviceID] {+ return true+ }+ for id := range e.asks {+ if t, err := e.opts.Store.GetTransfer(id); err == nil && t.DeviceID == deviceID {+ return true+ }+ }+ return false+}++// thumbnails 为收到的顶层图片生成缩略图(本机重新编码),与 items 一一对应,不是图片的为空。+func (e *Engine) thumbnails(items []store.Item, paths []string) []string {+ if e.opts.Thumbnail == nil {+ return nil+ }+ out := make([]string, len(items))+ found := false+ for i, it := range items {+ if it.IsDir || i >= len(paths) {+ continue+ }+ if out[i] = e.opts.Thumbnail(paths[i]); out[i] != "" {+ found = true+ }+ }+ if !found {+ return nil+ }+ return out+}++// askResult 把用户的决定换成给发送方的回答与本机记录的结果+func askResult(d string) (answer *pb.SendAnswer, status, code string) {+ switch d {+ case askDeclined:+ return &pb.SendAnswer{Reason: "declined"}, store.TransferDeclined, "declined"+ case askCancelled:+ return nil, store.TransferCancelled, "peer_cancelled"+ }+ return &pb.SendAnswer{Reason: "timeout"}, store.TransferDeclined, "timeout"+}diff --git a/client-core/internal/send/ask_test.go b/client-core/internal/send/ask_test.gonew file mode 100644index 0000000..815b959--- /dev/null+++ b/client-core/internal/send/ask_test.go@@ -0,0 +1,192 @@+package send++import (+ "os"+ "path/filepath"+ "runtime"+ "strings"+ "testing"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/store"+)++// friendPair 是两个互为好友的设备:bob 收 alice 发来的文件要问用户。+func friendPair(t *testing.T) *pair {+ t.Helper()+ p := newPair(t)+ for _, s := range []*side{p.a, p.b} {+ s.mu.Lock()+ s.role = store.RoleFriend+ s.admit = Admission{Allowed: true}+ s.mu.Unlock()+ }+ return p+}++func askingOn(t *testing.T, s *side) store.Transfer {+ t.Helper()+ var found store.Transfer+ waitFor(t, 15*time.Second, func() bool {+ list, _ := s.db.ListTransfers(store.Incoming, 10, time.Time{})+ for _, tr := range list {+ if tr.Status == store.TransferAsking {+ found = tr+ return true+ }+ }+ return false+ })+ return found+}++func TestFriendAskAccept(t *testing.T) {+ p := friendPair(t)+ src := t.TempDir()+ data := randomBytes(t, 200<<10)+ writeFile(t, filepath.Join(src, "合同.png"), data)+ script := filepath.Join(src, "run.sh")+ writeFile(t, script, []byte("#!/bin/sh\necho hi\n"))+ if err := os.Chmod(script, 0o755); err != nil {+ t.Fatal(err)+ }+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "合同.png"), script}, false, " 合同第 3 页要签字 ")+ if err != nil {+ t.Fatal(err)+ }+ waitStatus(t, p.a, tr.Id, store.TransferAsking)+ got := askingOn(t, p.b)+ if got.Note != "合同第 3 页要签字" || got.PeerRole != store.RoleFriend {+ t.Fatalf("接收方看到的备注或角色不对: %q %q", got.Note, got.PeerRole)+ }+ if _, _, err := p.b.eng.Answer(got.ID, true); err != nil {+ t.Fatal(err)+ }+ waitStatus(t, p.a, tr.Id, store.TransferDone)+ done := waitStatus(t, p.b, got.ID, store.TransferDone)+ sameFile(t, data, filepath.Join(p.b.recvDir, "合同.png"))+ if len(done.Thumbs) != 2 || done.Thumbs[0] != "thumb:合同.png" || done.Thumbs[1] != "" {+ t.Fatalf("缩略图不对: %v", done.Thumbs)+ }+ if runtime.GOOS != "windows" {+ info, err := os.Stat(filepath.Join(p.b.recvDir, "run.sh"))+ if err != nil {+ t.Fatal(err)+ }+ if info.Mode().Perm()&0o111 != 0 {+ t.Fatalf("好友发来的文件不该能执行: %v", info.Mode())+ }+ }+}++func TestFriendAskDeclineAndMute(t *testing.T) {+ p := friendPair(t)+ src := t.TempDir()+ writeFile(t, filepath.Join(src, "a.txt"), []byte("hello"))+ for i := 0; i < declineLimit; i++ {+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, "")+ if err != nil {+ t.Fatal(err)+ }+ got := askingOn(t, p.b)+ if _, _, err := p.b.eng.Answer(got.ID, false); err != nil {+ t.Fatal(err)+ }+ out := waitStatus(t, p.a, tr.Id, store.TransferDeclined)+ if out.Error != "declined" {+ t.Fatalf("发送方看到的原因不对: %q", out.Error)+ }+ waitStatus(t, p.b, got.ID, store.TransferDeclined)+ }+ // 一分钟内拒绝了 3 次:之后直接拒绝,不再问+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, "")+ if err != nil {+ t.Fatal(err)+ }+ out := waitStatus(t, p.a, tr.Id, store.TransferDeclined)+ if out.Error != "rate_limited" {+ t.Fatalf("应当被防打扰挡住: %q", out.Error)+ }+}++func TestFriendAskTimeoutAndNotAllowed(t *testing.T) {+ p := friendPair(t)+ src := t.TempDir()+ writeFile(t, filepath.Join(src, "a.txt"), []byte("hello"))+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, "")+ if err != nil {+ t.Fatal(err)+ }+ got := askingOn(t, p.b)+ if out := waitStatus(t, p.a, tr.Id, store.TransferDeclined); out.Error != "timeout" {+ t.Fatalf("没有回应应当是 timeout: %q", out.Error)+ }+ if in := waitStatus(t, p.b, got.ID, store.TransferDeclined); in.Error != "timeout" {+ t.Fatalf("接收方应当记为 timeout: %q", in.Error)+ }++ p.b.mu.Lock()+ p.b.admit = Admission{}+ p.b.mu.Unlock()+ tr, err = p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, "")+ if err != nil {+ t.Fatal(err)+ }+ if out := waitStatus(t, p.a, tr.Id, store.TransferDeclined); out.Error != "not_allowed" {+ t.Fatalf("对方不接收时应当是 not_allowed: %q", out.Error)+ }+}++func TestFriendAutoAccept(t *testing.T) {+ p := friendPair(t)+ p.b.mu.Lock()+ p.b.admit = Admission{Allowed: true, AutoAccept: true}+ p.b.mu.Unlock()+ src := t.TempDir()+ writeFile(t, filepath.Join(src, "a.txt"), []byte("hello"))+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, "")+ if err != nil {+ t.Fatal(err)+ }+ waitStatus(t, p.a, tr.Id, store.TransferDone)+}++// 发送方取消时,接收方的确认也随之结束+func TestFriendAskCancelledBySender(t *testing.T) {+ p := friendPair(t)+ src := t.TempDir()+ writeFile(t, filepath.Join(src, "a.txt"), []byte("hello"))+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, "")+ if err != nil {+ t.Fatal(err)+ }+ got := askingOn(t, p.b)+ if err := p.a.eng.Cancel(tr.Id); err != nil {+ t.Fatal(err)+ }+ waitStatus(t, p.b, got.ID, store.TransferCancelled)+ if _, _, err := p.b.eng.Answer(got.ID, true); err != ErrNotAsking {+ t.Fatalf("取消后不能再接受: %v", err)+ }+}++func TestSendToFriendNeedsAskAndValidNote(t *testing.T) {+ p := friendPair(t)+ src := t.TempDir()+ writeFile(t, filepath.Join(src, "a.txt"), []byte("hello"))+ for _, note := range []string{"第一行\n第二行", strings.Repeat("长", MaxNote+1), "a\x07b"} {+ if _, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, note); err != ErrBadNote {+ t.Fatalf("备注 %q 应当被拒: %v", note, err)+ }+ }+ if _, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, strings.Repeat("长", MaxNote)); err != nil {+ t.Fatalf("200 字的备注可以发: %v", err)+ }+ // 对方是旧版本:收到会直接接收、绕过确认,不能发给它+ p.a.mu.Lock()+ p.a.noAsk = true+ p.a.mu.Unlock()+ if _, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.txt")}, false, ""); err != ErrUnsupported {+ t.Fatalf("对方不能等用户接受时不该发: %v", err)+ }+}diff --git a/client-core/internal/send/incoming.go b/client-core/internal/send/incoming.goindex b6c52ed..651564b 100644--- a/client-core/internal/send/incoming.go+++ b/client-core/internal/send/incoming.go@@ -26,6 +26,7 @@ import (// incoming 是一批正在收的文件。type incoming struct {id, device string+ role string // 对方的角色:非自己的设备发来的文件去掉可执行权限attempt uint32offer *pb.SendOfferdest string // 保存位置@@ -101,16 +102,63 @@ func (e *Engine) handleOffer(from string, offer *pb.SendOffer) {a.TransferId, a.Attempt = id, offer.GetAttempt()_ = e.opts.Send(from, &pb.PeerMessage{Payload: &pb.PeerMessage_SendAnswer{SendAnswer: a}})}- if err := validOffer(offer); err != nil {+ note, noteOK := CleanNote(offer.GetNote())+ if err := validOffer(offer); err != nil || !noteOK {e.log.Warn("收到无效的隔空传送请求", "from", from, "err", err)answer(&pb.SendAnswer{Reason: "bad_offer"})return}cfg := e.opts.LoadConfig()- if cfg.ReceiveDisabled {+ role := p.Role+ if role == "" {+ role = store.RoleSelf+ }+ other := role != store.RoleSelf+ ask := false+ if other {+ // 好友、陌生设备:看「允许这些人给我发文件」,每次问用户,除非对这个好友打开了自动接收+ adm := Admission{}+ if e.opts.Admit != nil {+ adm = e.opts.Admit(from)+ }+ switch {+ case !adm.Allowed:+ answer(&pb.SendAnswer{Reason: "not_allowed"})+ return+ case e.isMuted(from):+ answer(&pb.SendAnswer{Reason: "rate_limited"})+ return+ }+ ask = !adm.AutoAccept && !offer.GetResume()+ } else if cfg.ReceiveDisabled {answer(&pb.SendAnswer{Reason: "disabled"})return}+ if ask {+ pending := store.Transfer{ID: id, Direction: store.Incoming, DeviceID: from, DeviceName: p.Name,+ Status: store.TransferAsking, Items: itemsFromOffer(offer), TotalBytes: offer.GetTotalBytes(),+ FileCount: offer.GetFileCount(), Relayed: p.Relayed, CreatedAt: e.opts.Now(), PeerRole: role, Note: note}+ if old, err := e.opts.Store.GetTransfer(id); err == nil && (old.Direction != store.Incoming || old.DeviceID != from) {+ answer(&pb.SendAnswer{Reason: "bad_offer"})+ return+ }+ answer(&pb.SendAnswer{Reason: "pending"})+ d := e.askUser(pending)+ if d != askAccept {+ a, status, code := askResult(d)+ if a != nil {+ answer(a)+ }+ e.finish(pending, status, code)+ switch d {+ case askDeclined:+ e.declined(from)+ case "timeout":+ e.notice(NoticeIgnored, pending)+ }+ return+ }+ }// 同一台设备一次只发一批:还挂着的旧接收一定是过时的(对方重启过或者重新发起了)e.mu.Lock()@@ -132,7 +180,7 @@ func (e *Engine) handleOffer(from string, offer *pb.SendOffer) {now := e.opts.Now()existing, getErr := e.opts.Store.GetTransfer(id)var t store.Transfer- in := &incoming{id: id, device: from, attempt: offer.GetAttempt(), offer: offer,+ in := &incoming{id: id, device: from, role: role, attempt: offer.GetAttempt(), offer: offer,tops: map[string]bool{}, names: pack.NewNames(),streamCh: make(chan io.ReadCloser, 1), done: make(chan struct{})}for _, it := range offer.GetItems() {@@ -182,6 +230,7 @@ func (e *Engine) handleOffer(from string, offer *pb.SendOffer) {in.partial = filepath.Join(in.dest, partialDir, id)}t.DeviceName = p.Name+ t.PeerRole, t.Note = role, notet.Items = itemsFromOffer(offer)t.TotalBytes, t.FileCount, t.DestDir = offer.GetTotalBytes(), offer.GetFileCount(), in.destt.Relayed = p.Relayed@@ -617,6 +666,10 @@ func (e *Engine) receiveFile(in *incoming, fr *pack.FrameReader, fs *pb.SendFile}} else {perm := os.FileMode(fs.GetMode()).Perm()&^0o022 | 0o600+ if in.role != store.RoleSelf {+ // 别人发来的文件不保留可执行权限+ perm &^= 0o111+ }f, err = os.OpenFile(target, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, perm)}if err != nil {@@ -760,7 +813,11 @@ func (e *Engine) finalize(in *incoming, t store.Transfer) error {t = e.withProgress(t)t.Items, t.Paths, t.DoneBytes, t.Renamed = items, finals, t.TotalBytes, renamed+ t.Thumbs = e.thumbnails(items, finals)e.finish(t, store.TransferDone, "")+ if in.role == store.RoleFriend && e.opts.Delivered != nil {+ e.opts.Delivered(in.device)+ }_ = e.opts.Send(in.device, &pb.PeerMessage{Payload: &pb.PeerMessage_SendResult{SendResult: &pb.SendResult{TransferId: t.ID, Attempt: in.attempt, Ok: true}}})e.log.Info("隔空传送已收到", "transfer", t.ID, "from", in.device, "字节", t.TotalBytes, "到", in.dest)diff --git a/client-core/internal/send/outgoing.go b/client-core/internal/send/outgoing.goindex 6d50c92..a5f21cd 100644--- a/client-core/internal/send/outgoing.go+++ b/client-core/internal/send/outgoing.go@@ -44,20 +44,26 @@ type peerCancel struct{ reason string }func (p *peerCancel) Error() string { return "对方取消了:" + p.reason }// SendFiles 把 paths 发给一台设备。立即返回这一批的记录:先统计,统计完排队,轮到了就发。-func (e *Engine) SendFiles(deviceID string, paths []string, allowRelay bool) (*pb.Transfer, error) {+func (e *Engine) SendFiles(deviceID string, paths []string, allowRelay bool, note string) (*pb.Transfer, error) {p := e.opts.Peer(deviceID)+ other := p.Role != "" && p.Role != store.RoleSelfswitch {case !p.Known:return nil, ErrUnknownDevicecase !p.Online:return nil, ErrOffline- case !p.Supported:+ case !p.Supported, other && !p.Ask:+ // 旧版本收到会直接接收,绕过对方用户的确认,所以不发return nil, ErrUnsupportedcase p.Disabled:return nil, ErrPeerDisabledcase len(paths) == 0:return nil, ErrNoPaths}+ note, ok := CleanNote(note)+ if !ok {+ return nil, ErrBadNote+ }clean := make([]string, 0, len(paths))items := make([]store.Item, 0, len(paths))for _, path := range paths {@@ -79,9 +85,13 @@ func (e *Engine) SendFiles(deviceID string, paths []string, allowRelay bool) (*pt := store.Transfer{ID: newID(), Direction: store.Outgoing, DeviceID: deviceID, DeviceName: p.Name,Status: store.TransferScanning, Items: items, Paths: clean, AllowRelay: allowRelay,- Relayed: p.Relayed, CreatedAt: now,+ Relayed: p.Relayed, CreatedAt: now, PeerRole: p.Role, Note: note,}e.save(t)+ if other && !p.Connected && e.opts.Connect != nil {+ // 好友不常连:现在连上,连上后(PeerReady)开始发+ go e.opts.Connect(deviceID)+ }e.wg.Add(1)go func() {defer e.wg.Done()@@ -232,7 +242,7 @@ func (e *Engine) runOutgoing(t store.Transfer) {ctx, cancel := context.WithCancelCause(e.ctx)defer cancel(nil)o := &outgoing{id: t.ID, device: t.DeviceID, ctx: ctx, cancel: cancel,- answer: make(chan *pb.SendAnswer, 1), result: make(chan *pb.SendResult, 1), done: make(chan struct{})}+ answer: make(chan *pb.SendAnswer, 2), result: make(chan *pb.SendResult, 1), done: make(chan struct{})}e.mu.Lock()e.out[t.ID] = oe.mu.Unlock()@@ -261,23 +271,44 @@ func (e *Engine) runOutgoing(t store.Transfer) {}offer := &pb.SendOffer{TransferId: t.ID, Attempt: uint32(t.Attempt), Items: items,TotalBytes: t.TotalBytes, FileCount: t.FileCount, LargestFile: largest,- CreatedAtUnix: t.CreatedAt.Unix(), Resume: !fresh}+ CreatedAtUnix: t.CreatedAt.Unix(), Resume: !fresh, Note: t.Note}if err := e.opts.Send(t.DeviceID, &pb.PeerMessage{Payload: &pb.PeerMessage_SendOffer{SendOffer: offer}}); err != nil {e.interrupt(t)return}var answer *pb.SendAnswer- select {- case answer = <-o.answer:- case <-ctx.Done():- e.stopped(t, context.Cause(ctx))- return- case <-time.After(e.opts.AnswerTimeout):- e.log.Info("对方没有应答", "transfer", t.ID)- e.interrupt(t)- return+ wait := time.NewTimer(e.opts.AnswerTimeout)+ waitAnswer:+ for {+ select {+ case answer = <-o.answer:+ if !answer.GetAccepted() && answer.GetReason() == "pending" {+ // 对方在等它的用户接受:多等一会儿+ t.Status = store.TransferAsking+ e.save(t)+ wait.Reset(e.opts.AskTimeout + askSlack)+ continue+ }+ break waitAnswer+ case <-ctx.Done():+ wait.Stop()+ e.stopped(t, context.Cause(ctx))+ return+ case <-wait.C:+ if t.Status == store.TransferAsking {+ e.log.Info("对方的用户没有回应", "transfer", t.ID)+ _ = e.opts.Send(t.DeviceID, &pb.PeerMessage{Payload: &pb.PeerMessage_SendCancel{+ SendCancel: &pb.SendCancel{TransferId: t.ID, Reason: "timeout"}}})+ e.finish(t, store.TransferDeclined, "timeout")+ return+ }+ e.log.Info("对方没有应答", "transfer", t.ID)+ e.interrupt(t)+ return+ }}+ wait.Stop()if !answer.GetAccepted() {if answer.GetReason() == "already_done" {// 上次其实已经收完了,只是结果没传回来(比如走局域网快速通道时控制通道恰好断了)@@ -339,6 +370,9 @@ func (e *Engine) runOutgoing(t store.Transfer) {if result.GetOk() {t.DoneBytes = t.TotalBytese.finish(t, store.TransferDone, "")+ if t.PeerRole == store.RoleFriend && e.opts.Delivered != nil {+ e.opts.Delivered(t.DeviceID)+ }e.log.Info("隔空传送已送达", "transfer", t.ID, "to", t.DeviceID, "字节", t.TotalBytes)return}@@ -511,6 +545,9 @@ func (e *Engine) handleResult(from string, r *pb.SendResult) {// 所以停下它以后等它退出,再按记录补做一次;它自己已经处理过取消的话,记录已经结束,不会重复。func (e *Engine) handleCancel(from string, c *pb.SendCancel) {id := c.GetTransferId()+ if e.cancelAsk(id, from) {+ return+ }cause := &peerCancel{reason: c.GetReason()}e.mu.Lock()o, in := e.out[id], e.in[id]diff --git a/client-core/internal/send/pipe_test.go b/client-core/internal/send/pipe_test.goindex a8931f5..5f32acb 100644--- a/client-core/internal/send/pipe_test.go+++ b/client-core/internal/send/pipe_test.go@@ -96,7 +96,7 @@ func TestSendOverLAN(t *testing.T) {t.Fatal(err)}- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "报告.pdf"), filepath.Join(src, "照片")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "报告.pdf"), filepath.Join(src, "照片")}, false, "")if err != nil {t.Fatal(err)}@@ -122,7 +122,7 @@ func TestResumeOverLAN(t *testing.T) {writeFile(t, filepath.Join(src, "a", "1.bin"), first)writeFile(t, filepath.Join(src, "a", "2.bin"), big)- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a")}, false, "")if err != nil {t.Fatal(err)}@@ -155,7 +155,7 @@ func TestCancelOverLAN(t *testing.T) {st := useLAN(t, p, false)src := t.TempDir()writeFile(t, filepath.Join(src, "big.bin"), randomBytes(t, 200<<20))- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "big.bin")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "big.bin")}, false, "")if err != nil {t.Fatal(err)}@@ -183,7 +183,7 @@ func TestFallsBackWhenLANRefused(t *testing.T) {src := t.TempDir()data := randomBytes(t, 5<<20)writeFile(t, filepath.Join(src, "a.bin"), data)- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.bin")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.bin")}, false, "")if err != nil {t.Fatal(err)}@@ -205,7 +205,7 @@ func TestNoLANAddrUsesDataChannel(t *testing.T) {src := t.TempDir()data := randomBytes(t, 2<<20)writeFile(t, filepath.Join(src, "a.bin"), data)- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.bin")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.bin")}, false, "")if err != nil {t.Fatal(err)}@@ -235,7 +235,7 @@ func TestResultLostAfterLANTransfer(t *testing.T) {src := t.TempDir()data := randomBytes(t, 3<<20)writeFile(t, filepath.Join(src, "a.bin"), data)- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.bin")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a.bin")}, false, "")if err != nil {t.Fatal(err)}diff --git a/client-core/internal/send/progress.go b/client-core/internal/send/progress.goindex 4705ec8..230c57c 100644--- a/client-core/internal/send/progress.go+++ b/client-core/internal/send/progress.go@@ -148,6 +148,10 @@ func (e *Engine) toProto(t store.Transfer) *pb.Transfer {Status: t.Status, Paths: t.Paths, TotalBytes: t.TotalBytes, DoneBytes: t.DoneBytes,FileCount: t.FileCount, Error: t.Error, ShortfallBytes: t.Shortfall, Relayed: t.Relayed,Seen: t.Seen, CreatedAtUnix: t.CreatedAt.Unix(), RenamedFiles: t.Renamed,+ PeerRole: t.PeerRole, Note: t.Note, Thumbs: t.Thumbs,+ }+ if p.PeerRole == "" {+ p.PeerRole = store.RoleSelf}if !t.FinishedAt.IsZero() {p.FinishedAtUnix = t.FinishedAt.Unix()diff --git a/client-core/internal/send/send.go b/client-core/internal/send/send.goindex df9fcf4..6ed5dcc 100644--- a/client-core/internal/send/send.go+++ b/client-core/internal/send/send.go@@ -38,6 +38,10 @@ var (ErrNoPaths = errors.New("no_paths")ErrNotFound = errors.New("not_found")ErrNotResumable = errors.New("not_resumable")+ // ErrBadNote:备注太长、有换行或控制字符+ ErrBadNote = errors.New("bad_note")+ // ErrNotAsking:这一批不在等本机的用户接受+ ErrNotAsking = errors.New("not_asking"))const (@@ -66,12 +70,26 @@ const (streamPrefix = "send:"partialDir = ".pasteferry-partial"++ // 好友、陌生设备发来的,等本机用户接受多久(发送方多等几秒,留出消息往返)+ defaultAskTimeout = 60 * time.Second+ askSlack = 10 * time.Second+ // 防打扰:一分钟内拒绝同一台电脑 3 次,之后 10 分钟它的请求直接拒绝+ declineWindow = time.Minute+ declineLimit = 3+ declineMute = 10 * time.Minute+ // MaxNote 是备注最多多少个字符+ MaxNote = 200)// Peer 是某台设备此刻的状态,由 peers.Manager 提供。type Peer struct {- Known bool // 已配对- Name string+ Known bool // 已配对,或者是好友、「所有人」模式下认识的陌生设备+ Name string+ // Role 是对方的角色:store.RoleSelf / RoleFriend / RoleStranger+ Role string+ // Ask 表示对方能等它的用户接受(声明了 send_files_ask_v1)。发给好友、陌生设备时必须有+ Ask boolOnline boolConnected bool // P2P 连接已建立Relayed bool // 连接经中转@@ -86,8 +104,18 @@ const (NoticeIncoming NoticeKind = iota // 较大的传输开始了NoticeReceived // 收完了NoticeFailed // 没收完+ NoticeAsk // 好友或陌生设备想发来文件,等用户接受+ NoticeIgnored // 没有接受也没有拒绝,过时了)+// Admission 是本机此刻收不收某台电脑发来的文件,由 peers.Manager 按角色和设置给出。+type Admission struct {+ // Allowed 为 false 时直接回绝(not_allowed)+ Allowed bool+ // AutoAccept 表示不用问用户(自己的设备,或者打开了自动接收的好友)+ AutoAccept bool+}+type Options struct {Logger *slog.LoggerStore *store.Store@@ -112,9 +140,18 @@ type Options struct {OnRemoved func(id string)OnNotice func(NoticeKind, *pb.Transfer)+ // 好友(2.6.0)。Admit 决定收不收别人发来的(为空时只收自己的设备);+ // Connect 在发给好友、陌生设备前建立连接(它们不常连);Thumbnail 为收到的图片生成缩略图,+ // 返回缩略图的路径,不是图片或生成失败时为空;Delivered 在发给或收到好友的一批完成时调用+ Admit func(deviceID string) Admission+ Connect func(deviceID string)+ Thumbnail func(path string) string+ Delivered func(deviceID string)+// 测试用AnswerTimeout time.DurationResultTimeout time.Duration+ AskTimeout time.DurationNow func() time.Time}@@ -136,6 +173,11 @@ type Engine struct {release func()// 进度事件的节流progress map[string]*meter+ // 等本机用户接受的:传输 ID → 用户的决定+ asks map[string]chan string+ // 防打扰:每台电脑最近被拒绝的时间、被静音到什么时候+ declines map[string][]time.Time+ muted map[string]time.Time}func New(opts Options) *Engine {@@ -152,11 +194,15 @@ func New(opts Options) *Engine {if opts.Now == nil {opts.Now = time.Now}+ if opts.AskTimeout <= 0 {+ opts.AskTimeout = defaultAskTimeout+ }ctx, stop := context.WithCancel(context.Background())return &Engine{opts: opts, log: log.With("模块", "隔空传送"), ctx: ctx, stop: stop,out: map[string]*outgoing{}, in: map[string]*incoming{},workers: map[string]bool{}, busy: map[string]bool{}, progress: map[string]*meter{},+ asks: map[string]chan string{}, declines: map[string][]time.Time{}, muted: map[string]time.Time{},}}@@ -224,6 +270,9 @@ func (e *Engine) recover() {t.Status = store.TransferInterruptedt.UpdatedAt = nowe.save(t)+ case t.Status == store.TransferAsking:+ // 等用户接受时后台服务退出了:对方早就超时了+ e.finish(t, store.TransferDeclined, "timeout")}}}@@ -344,8 +393,16 @@ func (e *Engine) Cancel(id string) error {return nil}e.mu.Lock()- o, in := e.out[id], e.in[id]+ o, in, ask := e.out[id], e.in[id], e.asks[id]e.mu.Unlock()+ if ask != nil {+ // 还在等本机用户接受:当作拒绝+ select {+ case ask <- askDeclined:+ default:+ }+ return nil+ }if o != nil {o.abort(errCancelled)return nildiff --git a/client-core/internal/send/send_test.go b/client-core/internal/send/send_test.goindex a662ede..0080f46 100644--- a/client-core/internal/send/send_test.go+++ b/client-core/internal/send/send_test.go@@ -33,6 +33,11 @@ type side struct {blockOut bool // 模拟连接断了:控制消息发不出去dropResult bool // 模拟「已收到」的结果在路上丢了dropOffers int // 模拟请求落在对方重启前的旧连接里++ // 好友(2.6.0):本端眼里对方的角色、对方能不能等用户接受、本端收不收对方的+ role string+ noAsk bool+ admit Admission}func (s *side) config() config.Config {@@ -147,10 +152,24 @@ func (p *pair) newSide(t *testing.T, id, peer string) *side {return Peer{}}st := s.mgr.State(deviceID)+ s.mu.Lock()+ defer s.mu.Unlock()return Peer{Known: true, Name: deviceID, Online: true, Connected: connected(st),- Relayed: st == p2p.StateRelay, Supported: true}+ Relayed: st == p2p.StateRelay, Supported: true, Role: s.role, Ask: !s.noAsk}+ },+ Admit: func(string) Admission {+ s.mu.Lock()+ defer s.mu.Unlock()+ return s.admit+ },+ Thumbnail: func(path string) string {+ if filepath.Ext(path) == ".png" {+ return "thumb:" + filepath.Base(path)+ }+ return ""},AnswerTimeout: 10 * time.Second,+ AskTimeout: 2 * time.Second,})s.eng.Start()t.Cleanup(s.eng.Close)@@ -234,7 +253,7 @@ func TestSendFilesAndFolder(t *testing.T) {// 对方的保存位置里已经有一个同名文件:收到的要改名,不能覆盖writeFile(t, filepath.Join(p.b.recvDir, "报告.pdf"), []byte("old"))- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "报告.pdf"), filepath.Join(src, "照片")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "报告.pdf"), filepath.Join(src, "照片")}, false, "")if err != nil {t.Fatal(err)}@@ -285,7 +304,7 @@ func TestResumeWhenReconnectPrecedesAnswerTimeout(t *testing.T) {path := filepath.Join(t.TempDir(), "restart.bin")data := randomBytes(t, 1<<20)writeFile(t, path, data)- tr, err := p.a.eng.SendFiles("bob", []string{path}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{path}, false, "")if err != nil {t.Fatal(err)}@@ -314,7 +333,7 @@ func TestConnectedRetryStopsAfterOneAttempt(t *testing.T) {p.a.mu.Unlock()path := filepath.Join(t.TempDir(), "retry.txt")writeFile(t, path, []byte("retry"))- tr, err := p.a.eng.SendFiles("bob", []string{path}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{path}, false, "")if err != nil {t.Fatal(err)}@@ -337,7 +356,7 @@ func TestCancelDuringConnectedRetry(t *testing.T) {p.a.mu.Unlock()path := filepath.Join(t.TempDir(), "cancel.txt")writeFile(t, path, []byte("cancel"))- tr, err := p.a.eng.SendFiles("bob", []string{path}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{path}, false, "")if err != nil {t.Fatal(err)}@@ -360,7 +379,7 @@ func TestResumeAfterInterruption(t *testing.T) {writeFile(t, filepath.Join(src, "a", "1.bin"), first)writeFile(t, filepath.Join(src, "a", "2.bin"), big)- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "a")}, false, "")if err != nil {t.Fatal(err)}@@ -403,7 +422,7 @@ func TestCancelBySender(t *testing.T) {p := newPair(t)src := t.TempDir()writeFile(t, filepath.Join(src, "big.bin"), randomBytes(t, 60<<20))- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "big.bin")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "big.bin")}, false, "")if err != nil {t.Fatal(err)}@@ -428,7 +447,7 @@ func TestReceiveDisabled(t *testing.T) {p.b.mu.Unlock()src := t.TempDir()writeFile(t, filepath.Join(src, "x.txt"), []byte("hi"))- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "x.txt")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "x.txt")}, false, "")if err != nil {t.Fatal(err)}@@ -451,7 +470,7 @@ func TestSourceChangedBeforeSending(t *testing.T) {p.a.mu.Lock()p.a.blockOut = truep.a.mu.Unlock()- tr, err := p.a.eng.SendFiles("bob", []string{path}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{path}, false, "")if err != nil {t.Fatal(err)}@@ -507,7 +526,7 @@ func TestDeclinesWhenSaveLocationIsGone(t *testing.T) {p.b.mu.Unlock()src := t.TempDir()writeFile(t, filepath.Join(src, "x.txt"), []byte("hi"))- tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "x.txt")}, false)+ tr, err := p.a.eng.SendFiles("bob", []string{filepath.Join(src, "x.txt")}, false, "")if err != nil {t.Fatal(err)}@@ -544,12 +563,12 @@ func TestRefusesPeersThatCannotReceive(t *testing.T) {}for _, c := range cases {c.set()- if _, err := e.SendFiles("x", []string{src}, false); err != c.want {+ if _, err := e.SendFiles("x", []string{src}, false, ""); err != c.want {t.Errorf("%s:应返回 %v,实际 %v", c.name, c.want, err)}}peer = Peer{Known: true, Online: true, Connected: true, Supported: true}- if _, err := e.SendFiles("x", []string{filepath.Join(t.TempDir(), "不存在")}, false); err == nil {+ if _, err := e.SendFiles("x", []string{filepath.Join(t.TempDir(), "不存在")}, false, ""); err == nil {t.Error("路径不存在时应当报错")}}@@ -570,10 +589,10 @@ func TestOfficialRelayNeedsConsent(t *testing.T) {},Send: func(string, *pb.PeerMessage) error { return p2p.ErrNotConnected }})defer e.Close()- if _, err := e.SendFiles("x", []string{src}, false); err != ErrNeedRelayConsent {+ if _, err := e.SendFiles("x", []string{src}, false, ""); err != ErrNeedRelayConsent {t.Fatalf("经官方中转时应先征得同意,实际 %v", err)}- if _, err := e.SendFiles("x", []string{src}, true); err != nil {+ if _, err := e.SendFiles("x", []string{src}, true, ""); err != nil {t.Fatalf("同意后应当能发:%v", err)}}diff --git a/client-core/internal/store/contact.go b/client-core/internal/store/contact.gonew file mode 100644index 0000000..a8010ea--- /dev/null+++ b/client-core/internal/store/contact.go@@ -0,0 +1,224 @@+package store++import (+ "database/sql"+ "errors"+ "fmt"+ "strings"+ "time"+)++// Contact 是一个好友:对方的一台电脑,见 design/friends-send.md 第 4 节。+//+// 好友和配对设备分开存:剪贴板同步、快捷粘贴、收藏都只读 devices,按结构就碰不到好友。+type Contact struct {+ ID string+ PublicKey []byte+ DisplayName string+ DeviceName string+ Platform string+ // Service 是对方用的服务:official / custom / lan;ServerHash 是它自建服务器地址的哈希+ Service string+ ServerHash []byte+ // AvatarHash 是对方名片里的头像哈希,AvatarPath 是本机重新编码后存下的头像(可能还没取到)+ AvatarHash []byte+ AvatarPath string+ Features []string+ AppVersion string+ AutoAccept bool+ AddedAt time.Time+ LastActivity time.Time+}++const contactsSchema = `+CREATE TABLE IF NOT EXISTS contacts (+ device_id TEXT PRIMARY KEY,+ public_key BLOB NOT NULL,+ display_name TEXT NOT NULL DEFAULT '',+ device_name TEXT NOT NULL DEFAULT '',+ platform TEXT NOT NULL DEFAULT '',+ service TEXT NOT NULL DEFAULT '',+ server_hash BLOB,+ avatar_hash BLOB,+ avatar_path TEXT NOT NULL DEFAULT '',+ features TEXT NOT NULL DEFAULT '',+ app_version TEXT NOT NULL DEFAULT '',+ auto_accept INTEGER NOT NULL DEFAULT 0,+ added_at INTEGER NOT NULL,+ last_activity INTEGER NOT NULL DEFAULT 0+);+-- 删除好友后要补发给对方的通知:对方不在线时排队,连上再发,最多 30 天+CREATE TABLE IF NOT EXISTS pending_notices (+ device_id TEXT PRIMARY KEY,+ public_key BLOB NOT NULL,+ created_at INTEGER NOT NULL+);+-- 「所有人」模式下被屏蔽的陌生设备+CREATE TABLE IF NOT EXISTS blocked_devices (+ device_id TEXT PRIMARY KEY,+ at INTEGER NOT NULL+);`++func (s *Store) migrateContacts() error {+ if _, err := s.db.Exec(contactsSchema); err != nil {+ return fmt.Errorf("建好友表: %w", err)+ }+ return nil+}++const contactColumns = `device_id, public_key, display_name, device_name, platform, service, server_hash,+ avatar_hash, avatar_path, features, app_version, auto_accept, added_at, last_activity`++func scanContact(row interface{ Scan(...any) error }) (Contact, error) {+ var c Contact+ var features string+ var auto int+ var added, last int64+ err := row.Scan(&c.ID, &c.PublicKey, &c.DisplayName, &c.DeviceName, &c.Platform, &c.Service,+ &c.ServerHash, &c.AvatarHash, &c.AvatarPath, &features, &c.AppVersion, &auto, &added, &last)+ if err != nil {+ return c, err+ }+ if features != "" {+ c.Features = strings.Split(features, ",")+ }+ c.AutoAccept = auto != 0+ c.AddedAt = time.Unix(added, 0)+ if last > 0 {+ c.LastActivity = time.Unix(last, 0)+ }+ return c, nil+}++// PutContact 新加或更新一个好友。更新时不动自动接收、加好友的时间和最近一次传输的时间+func (s *Store) PutContact(c Contact) error {+ if c.AddedAt.IsZero() {+ c.AddedAt = time.Now()+ }+ _, err := s.db.Exec(`+INSERT INTO contacts (`+contactColumns+`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)+ON CONFLICT(device_id) DO UPDATE SET+ public_key=excluded.public_key, display_name=excluded.display_name, device_name=excluded.device_name,+ platform=excluded.platform, service=excluded.service, server_hash=excluded.server_hash,+ avatar_hash=excluded.avatar_hash, avatar_path=excluded.avatar_path,+ features=excluded.features, app_version=excluded.app_version`,+ c.ID, c.PublicKey, c.DisplayName, c.DeviceName, c.Platform, c.Service, c.ServerHash,+ c.AvatarHash, c.AvatarPath, strings.Join(c.Features, ","), c.AppVersion, boolInt(c.AutoAccept),+ c.AddedAt.Unix(), unixOrZero(c.LastActivity))+ return err+}++func (s *Store) ListContacts() ([]Contact, error) {+ rows, err := s.db.Query(`SELECT ` + contactColumns + ` FROM contacts ORDER BY added_at`)+ if err != nil {+ return nil, err+ }+ defer rows.Close()+ var out []Contact+ for rows.Next() {+ c, err := scanContact(rows)+ if err != nil {+ return nil, err+ }+ out = append(out, c)+ }+ return out, rows.Err()+}++// ErrNoContact 表示没有这个好友+var ErrNoContact = errors.New("没有这个好友")++func (s *Store) GetContact(id string) (Contact, error) {+ c, err := scanContact(s.db.QueryRow(`SELECT `+contactColumns+` FROM contacts WHERE device_id=?`, id))+ if errors.Is(err, sql.ErrNoRows) {+ return c, ErrNoContact+ }+ return c, err+}++func (s *Store) DeleteContact(id string) error {+ _, err := s.db.Exec(`DELETE FROM contacts WHERE device_id=?`, id)+ return err+}++func (s *Store) SetContactAutoAccept(id string, auto bool) error {+ res, err := s.db.Exec(`UPDATE contacts SET auto_accept=? WHERE device_id=?`, boolInt(auto), id)+ if err != nil {+ return err+ }+ if n, _ := res.RowsAffected(); n == 0 {+ return ErrNoContact+ }+ return nil+}++func (s *Store) TouchContact(id string, at time.Time) error {+ _, err := s.db.Exec(`UPDATE contacts SET last_activity=? WHERE device_id=?`, at.Unix(), id)+ return err+}++// PutPendingNotice 记下要补发给 id 的删除好友通知+func (s *Store) PutPendingNotice(id string, publicKey []byte, at time.Time) error {+ _, err := s.db.Exec(`INSERT INTO pending_notices (device_id, public_key, created_at) VALUES (?,?,?)+ON CONFLICT(device_id) DO UPDATE SET created_at=excluded.created_at`, id, publicKey, at.Unix())+ return err+}++type PendingNotice struct {+ ID string+ PublicKey []byte+ CreatedAt time.Time+}++// PendingNotices 返回还没送出的删除好友通知,顺便清掉 since 之前的(太久没连上,不再补发)+func (s *Store) PendingNotices(since time.Time) ([]PendingNotice, error) {+ if _, err := s.db.Exec(`DELETE FROM pending_notices WHERE created_at < ?`, since.Unix()); err != nil {+ return nil, err+ }+ rows, err := s.db.Query(`SELECT device_id, public_key, created_at FROM pending_notices`)+ if err != nil {+ return nil, err+ }+ defer rows.Close()+ var out []PendingNotice+ for rows.Next() {+ var n PendingNotice+ var at int64+ if err := rows.Scan(&n.ID, &n.PublicKey, &at); err != nil {+ return nil, err+ }+ n.CreatedAt = time.Unix(at, 0)+ out = append(out, n)+ }+ return out, rows.Err()+}++func (s *Store) DeletePendingNotice(id string) error {+ _, err := s.db.Exec(`DELETE FROM pending_notices WHERE device_id=?`, id)+ return err+}++func (s *Store) BlockDevice(id string, at time.Time) error {+ _, err := s.db.Exec(`INSERT OR REPLACE INTO blocked_devices (device_id, at) VALUES (?,?)`, id, at.Unix())+ return err+}++func (s *Store) IsBlocked(id string) bool {+ var n int+ _ = s.db.QueryRow(`SELECT COUNT(*) FROM blocked_devices WHERE device_id=?`, id).Scan(&n)+ return n > 0+}++func boolInt(b bool) int {+ if b {+ return 1+ }+ return 0+}++func unixOrZero(t time.Time) int64 {+ if t.IsZero() {+ return 0+ }+ return t.Unix()+}diff --git a/client-core/internal/store/transfer.go b/client-core/internal/store/transfer.goindex a16cb3e..f45214a 100644--- a/client-core/internal/store/transfer.go+++ b/client-core/internal/store/transfer.go@@ -31,6 +31,15 @@ const (TransferCancelled = "cancelled"TransferDeclined = "declined"TransferExpired = "expired"+ // TransferAsking:别人发来的、在等本机用户接受;发出的、在等对方用户接受(2.6.0,好友与陌生设备)+ TransferAsking = "asking"+)++// 对方是谁,见 daemon.proto 的 Transfer.peer_role+const (+ RoleSelf = "self"+ RoleFriend = "friend"+ RoleStranger = "stranger")// TransferFinished 表示这个状态不会再变。@@ -61,6 +70,11 @@ type Transfer struct {AllowRelay bool // 发出的:用户已同意经官方服务中转Attempt int // 发出的:已经发起过几次Renamed int64 // 收到的:名字在本机改过的文件数+ // PeerRole 是对方的角色,旧记录为空(都是自己的设备)+ PeerRole string+ Note string+ // Thumbs 是收到的图片在本机生成的缩略图,与 Items 一一对应+ Thumbs []stringCreatedAt time.TimeUpdatedAt time.TimeFinishedAt time.Time@@ -125,8 +139,18 @@ CREATE TABLE IF NOT EXISTS transfer_entries (if err != nil {return fmt.Errorf("建隔空传送表: %w", err)}- // 测试版建的表没有这一列- return s.addColumnIfMissing("transfers", "renamed", "INTEGER NOT NULL DEFAULT 0")+ // 测试版建的表没有 renamed;peer_role、note、thumbs 是 2.6.0 加的+ for _, col := range []struct{ name, decl string }{+ {"renamed", "INTEGER NOT NULL DEFAULT 0"},+ {"peer_role", "TEXT NOT NULL DEFAULT ''"},+ {"note", "TEXT NOT NULL DEFAULT ''"},+ {"thumbs", "TEXT NOT NULL DEFAULT '[]'"},+ } {+ if err := s.addColumnIfMissing("transfers", col.name, col.decl); err != nil {+ return err+ }+ }+ return s.migrateContacts()}// PutTransfer 新建或整体更新一条传输记录。@@ -142,6 +166,13 @@ func (s *Store) PutTransfer(t Transfer) error {if err != nil {return err}+ if t.Thumbs == nil {+ t.Thumbs = []string{}+ }+ thumbs, err := json.Marshal(t.Thumbs)+ if err != nil {+ return err+ }var finished int64if !t.FinishedAt.IsZero() {finished = t.FinishedAt.Unix()@@ -152,18 +183,21 @@ func (s *Store) PutTransfer(t Transfer) error {_, err = s.db.Exec(`INSERT INTO transfers (id, direction, device_id, device_name, status, items, paths,total_bytes, done_bytes, file_count, dest_dir, error, shortfall,- seen, relayed, allow_relay, attempt, created_at, updated_at, finished_at, renamed)-VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)+ seen, relayed, allow_relay, attempt, created_at, updated_at, finished_at, renamed,+ peer_role, note, thumbs)+VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)ON CONFLICT(id) DO UPDATE SETdevice_name=excluded.device_name, status=excluded.status, items=excluded.items,paths=excluded.paths, total_bytes=excluded.total_bytes, done_bytes=excluded.done_bytes,file_count=excluded.file_count, dest_dir=excluded.dest_dir, error=excluded.error,shortfall=excluded.shortfall, seen=excluded.seen, relayed=excluded.relayed,allow_relay=excluded.allow_relay, attempt=excluded.attempt,- updated_at=excluded.updated_at, finished_at=excluded.finished_at, renamed=excluded.renamed`,+ updated_at=excluded.updated_at, finished_at=excluded.finished_at, renamed=excluded.renamed,+ peer_role=excluded.peer_role, note=excluded.note, thumbs=excluded.thumbs`,t.ID, t.Direction, t.DeviceID, t.DeviceName, t.Status, string(items), string(paths),t.TotalBytes, t.DoneBytes, t.FileCount, t.DestDir, t.Error, t.Shortfall,- t.Seen, t.Relayed, t.AllowRelay, t.Attempt, t.CreatedAt.Unix(), t.UpdatedAt.Unix(), finished, t.Renamed)+ t.Seen, t.Relayed, t.AllowRelay, t.Attempt, t.CreatedAt.Unix(), t.UpdatedAt.Unix(), finished, t.Renamed,+ t.PeerRole, t.Note, string(thumbs))if err != nil {return fmt.Errorf("写入传输记录: %w", err)}@@ -179,7 +213,8 @@ func nonNilItems(items []Item) []Item {const transferColumns = `id, direction, device_id, device_name, status, items, paths,total_bytes, done_bytes, file_count, dest_dir, error, shortfall,- seen, relayed, allow_relay, attempt, created_at, updated_at, finished_at, renamed`+ seen, relayed, allow_relay, attempt, created_at, updated_at, finished_at, renamed,+ peer_role, note, thumbs`func (s *Store) GetTransfer(id string) (Transfer, error) {list, err := s.queryTransfers(`SELECT `+transferColumns+` FROM transfers WHERE id=?`, id)@@ -227,15 +262,17 @@ func (s *Store) queryTransfers(q string, args ...any) ([]Transfer, error) {var out []Transferfor rows.Next() {var t Transfer- var items, paths string+ var items, paths, thumbs stringvar created, updated, finished int64if err := rows.Scan(&t.ID, &t.Direction, &t.DeviceID, &t.DeviceName, &t.Status, &items, &paths,&t.TotalBytes, &t.DoneBytes, &t.FileCount, &t.DestDir, &t.Error, &t.Shortfall,- &t.Seen, &t.Relayed, &t.AllowRelay, &t.Attempt, &created, &updated, &finished, &t.Renamed); err != nil {+ &t.Seen, &t.Relayed, &t.AllowRelay, &t.Attempt, &created, &updated, &finished, &t.Renamed,+ &t.PeerRole, &t.Note, &thumbs); err != nil {return nil, err}_ = json.Unmarshal([]byte(items), &t.Items)_ = json.Unmarshal([]byte(paths), &t.Paths)+ _ = json.Unmarshal([]byte(thumbs), &t.Thumbs)t.CreatedAt = time.Unix(created, 0)t.UpdatedAt = time.Unix(updated, 0)if finished > 0 {diff --git a/client-core/internal/transport/lan/lan.go b/client-core/internal/transport/lan/lan.goindex 9e791ff..60362c2 100644--- a/client-core/internal/transport/lan/lan.go+++ b/client-core/internal/transport/lan/lan.go@@ -73,6 +73,9 @@ type PeerInfo struct {PublicKey []byte// Addrs 是对方自报的地址加上实际收到回复的地址,确认配对后写进地址簿Addrs []string+ // Intent 是对方这次要配对还是加好友(IntentDevice / IntentFriend),Card 是加好友时对方的名片+ Intent string+ Card *pb.FriendCard}// AddrBook 持久化已配对设备的地址,由 store.Store 实现。@@ -108,6 +111,9 @@ type Options struct {// AcceptNearby 在有人从「搜索附近设备」里点了本机时调用(只在本机也开着这个窗口时)。// 返回 false 会拒绝请求AcceptNearby func(peer PeerInfo) bool+ // AcceptStranger 在「所有人」模式下有陌生设备要本机的公钥(想发文件)时调用,返回本机的名片;+ // 返回 nil 会拒绝请求。见 stranger.go+ AcceptStranger func(peer PeerInfo) *pb.FriendCard// OnChange 在开关、系统拦截状态变化时调用,用来刷新界面上的状态OnChange func()}@@ -176,6 +182,8 @@ type Transport struct {visibleName stringvisiblePlatform stringnearby map[string]*nearbyState // mDNS 实例名 → 附近设备+ // everyone 非空时本机开着「所有人」:广播里带 e=1 和名字,见 stranger.go+ everyone *everyoneState// nextProbe 是下一次探测本地网络权限的时间,probeAddr 是探测的地址,见 probeTargetnextProbe time.TimeprobeAddr netip.Addr@@ -558,6 +566,8 @@ func (t *Transport) handle(pkt *pb.LanPacket, src netip.AddrPort) {t.handlePairResponse(p.PairResponse, src)case *pb.LanPacket_PairReject:t.handlePairReject(p.PairReject)+ case *pb.LanPacket_StrangerRequest:+ t.handleStrangerRequest(p.StrangerRequest, src)case *pb.LanPacket_NearbyRequest:t.handleNearbyRequest(p.NearbyRequest, src)case *pb.LanPacket_NearbyPing:@@ -906,6 +916,7 @@ func (t *Transport) advertTextLocked() map[string]string {text["s"] = "1"}t.nearbyAdvertLocked(text)+ t.everyoneAdvertLocked(text)return text}diff --git a/client-core/internal/transport/lan/pairing.go b/client-core/internal/transport/lan/pairing.goindex 70a8bce..d408538 100644--- a/client-core/internal/transport/lan/pairing.go+++ b/client-core/internal/transport/lan/pairing.go@@ -33,12 +33,30 @@ var (ErrWrongCode = errors.New("配对码不对")ErrCodeClosed = errors.New("配对码已失效")ErrTooManyAttempts = errors.New("配对码输错次数太多,已失效")+ // 码是对的,但对方开放的是好友码(这边在配对)或配对码(这边在加好友)+ ErrIsFriendCode = errors.New("这是好友码")+ ErrIsDeviceCode = errors.New("这是配对码"))+// 配对码的用途,见 LanPairInfo.intent。旧版本不带,当作配对+const (+ IntentDevice = "device"+ IntentFriend = "friend"+)++func normIntent(s string) string {+ if s == IntentFriend {+ return IntentFriend+ }+ return IntentDevice+}+type pairingState struct {code stringexpires time.Timeattempts int+ intent string+ card *pb.FriendCard}// cachedResponse 是发出去的配对回复:对方没收到而重发请求时原样再发一次。@@ -60,8 +78,13 @@ type pairResult struct {// OpenPairing 在局域网里开放一个配对码,有效期到 expires。func (t *Transport) OpenPairing(code string, expires time.Time) {+ t.OpenPairingFor(code, expires, IntentDevice, nil)+}++// OpenPairingFor 开放一个配对码或好友码(intent),加好友时回复里带上 card。+func (t *Transport) OpenPairingFor(code string, expires time.Time, intent string, card *pb.FriendCard) {t.mu.Lock()- t.pairing = &pairingState{code: pairingcode.Normalize(code), expires: expires}+ t.pairing = &pairingState{code: pairingcode.Normalize(code), expires: expires, intent: normIntent(intent), card: card}t.mu.Unlock()t.updateAdvert()}@@ -80,11 +103,19 @@ func (t *Transport) ClosePairing() {// Pair 用配对码在局域网里找到对方并交换公钥,直到 ctx 结束。extra 是用户输入的地址,// 不在同一网段(mDNS 过不去)时靠它。func (t *Transport) Pair(ctx context.Context, code string, extra []netip.AddrPort) (PeerInfo, error) {+ return t.PairFor(ctx, code, extra, IntentDevice, nil)+}++// PairFor 与 Pair 相同,intent 说明这次是配对还是加好友,加好友时请求里带上 card。+func (t *Transport) PairFor(ctx context.Context, code string, extra []netip.AddrPort, intent string, card *pb.FriendCard) (PeerInfo, error) {if !t.Running() {return PeerInfo{}, ErrDisabled}req := t.selfPairInfo()req.Code = pairingcode.Normalize(code)+ if normIntent(intent) == IntentFriend {+ req.Intent, req.Card = IntentFriend, card+ }return t.exchange(ctx, req, pairRequest, func() []netip.AddrPort { return t.pairTargets(extra) }, true)}@@ -166,6 +197,10 @@ func (t *Transport) rejectError(w *pairWaiter, final bool) error {return ErrWrongCodecase w.rejects["too_many_attempts"]:return ErrTooManyAttempts+ case w.rejects["intent_friend"]:+ return ErrIsFriendCode+ case w.rejects["intent_device"]:+ return ErrIsDeviceCode}return ErrCodeClosed}@@ -198,6 +233,8 @@ func (t *Transport) handlePairRequest(ps *pb.LanPairSigned, src netip.AddrPort)p := t.pairingreason := ""closeAdvert := false+ var intent string+ var card *pb.FriendCardswitch {case p == nil || now.After(p.expires):reason = "closed"@@ -208,7 +245,11 @@ func (t *Transport) handlePairRequest(ps *pb.LanPairSigned, src netip.AddrPort)t.log.Warn("配对码输错次数太多,已作废", "src", src)t.pairing, reason, closeAdvert = nil, "too_many_attempts", true}+ case normIntent(info.GetIntent()) != p.intent:+ // 码对了但用途不一致:告诉对方这是什么码,不用掉它,对方换个入口还能再输+ reason = "intent_" + p.intentdefault:+ intent, card = p.intent, p.card// 码对了:先撤下,同一个码不会再被第二个人用到t.pairing, closeAdvert = nil, true}@@ -227,7 +268,7 @@ func (t *Transport) handlePairRequest(ps *pb.LanPairSigned, src netip.AddrPort)return}t.log.Info("局域网配对请求已接受,等待用户核对指纹", "peer", peer.Name, "src", src)- t.respondPair(info, peer, src)+ t.respondPairFor(info, peer, src, intent, card)}// resendResponse:对方没收到回复而重发了同一个请求时,把那份回复原样再发一次。@@ -243,7 +284,15 @@ func (t *Transport) resendResponse(nonce []byte, src netip.AddrPort) bool {// respondPair 回复一个已接受的配对请求:本机的信息,回显请求的 nonce。func (t *Transport) respondPair(info *pb.LanPairInfo, peer PeerInfo, src netip.AddrPort) {+ t.respondPairFor(info, peer, src, IntentDevice, nil)+}++func (t *Transport) respondPairFor(info *pb.LanPairInfo, peer PeerInfo, src netip.AddrPort, intent string, card *pb.FriendCard) {resp := t.selfPairInfo()+ if intent == IntentFriend {+ resp.Intent = IntentFriend+ }+ resp.Card = cardresp.Nonce = make([]byte, 16)_, _ = cryptorand.Read(resp.Nonce)resp.RequestNonce = info.GetNonce()@@ -266,6 +315,8 @@ func peerFromInfo(info *pb.LanPairInfo, src netip.AddrPort) PeerInfo {Platform: info.GetPlatform(),PublicKey: info.GetPublicKey(),Addrs: mergeAddrs(info.GetAddresses(), src),+ Intent: normIntent(info.GetIntent()),+ Card: info.GetCard(),}}@@ -332,7 +383,8 @@ type pairKind intconst (pairRequest pairKind = iotapairResponse- nearbyRequest // 在「搜索附近设备」里点了对方,不带配对码+ nearbyRequest // 在「搜索附近设备」里点了对方,不带配对码+ strangerRequest // 「所有人」模式:要对方的公钥以便发文件)func (t *Transport) encodePairInfo(info *pb.LanPairInfo, kind pairKind) ([]byte, error) {@@ -346,6 +398,8 @@ func (t *Transport) encodePairInfo(info *pb.LanPairInfo, kind pairKind) ([]byte,return encode(&pb.LanPacket{Payload: &pb.LanPacket_PairRequest{PairRequest: ps}})case nearbyRequest:return encode(&pb.LanPacket{Payload: &pb.LanPacket_NearbyRequest{NearbyRequest: ps}})+ case strangerRequest:+ return encode(&pb.LanPacket{Payload: &pb.LanPacket_StrangerRequest{StrangerRequest: ps}})}return encode(&pb.LanPacket{Payload: &pb.LanPacket_PairResponse{PairResponse: ps}})}diff --git a/client-core/internal/transport/lan/stranger.go b/client-core/internal/transport/lan/stranger.gonew file mode 100644index 0000000..fba3b8f--- /dev/null+++ b/client-core/internal/transport/lan/stranger.go@@ -0,0 +1,137 @@+package lan++import (+ "context"+ "errors"+ "net/netip"+ "sort"+ "time"++ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// 「所有人」模式(2.6.0,见 design/friends-send.md 第 9.1 节):只在局域网里。+//+// - 接收方打开「所有人」期间,广播里带 e=1 和名字(n、o,编码同「搜索附近设备」);+// - 发送方在隔空传送页上看到它们(Strangers),要发文件时先发一个签名的 stranger_request+// (带自己的名片),对方开着「所有人」就回自己的签名信息和名片。两边从此认得对方的公钥,+// 之后的 P2P 连接、发文件、接收方的确认都与好友相同;+// - 「所有人」关掉后,广播撤下,新的请求一律拒绝。++// strangerStale 是多久没再在 mDNS 里见到就不列出(mDNS 不报下线,这里只能宽一点)+const strangerStale = 10 * time.Minute++type everyoneState struct {+ name, platform string+}++// StrangerInstance 是附近一台开着「所有人」的设备。+type StrangerInstance struct {+ ID string // mDNS 实例名+ Name string+ Platform string+ // PeerID 非空表示这是已配对的设备或好友(按广播里的令牌认出来的)+ PeerID string+}++// ShowEveryone 打开「所有人」:在局域网里公开名字,接受陌生设备的请求。name 为空时撤下。+func (t *Transport) ShowEveryone(name, platform string) {+ t.mu.Lock()+ changed := false+ if name == "" {+ changed = t.everyone != nil+ t.everyone = nil+ } else {+ next := &everyoneState{name: name, platform: platform}+ changed = t.everyone == nil || *t.everyone != *next+ t.everyone = next+ }+ t.mu.Unlock()+ if changed {+ t.updateAdvert()+ }+}++func (t *Transport) everyoneAdvertLocked(text map[string]string) {+ if t.everyone == nil {+ return+ }+ text["e"] = "1"+ text["n"] = encodeNearbyName(t.everyone.name)+ if t.everyone.platform != "" {+ text["o"] = t.everyone.platform+ }+}++// Strangers 返回附近开着「所有人」的设备,按名字排序。+func (t *Transport) Strangers() []StrangerInstance {+ now := time.Now()+ t.mu.Lock()+ defer t.mu.Unlock()+ if !t.running {+ return nil+ }+ var out []StrangerInstance+ for id, si := range t.instances {+ if si.inst.Text["e"] != "1" || now.Sub(si.seen) > strangerStale {+ continue+ }+ name, ok := nearbyName(si.inst.Text)+ if !ok {+ continue+ }+ out = append(out, StrangerInstance{ID: id, Name: name, Platform: si.inst.Text["o"], PeerID: t.tokens[si.inst.Text["t"]]})+ }+ sort.Slice(out, func(i, j int) bool {+ if out[i].Name != out[j].Name {+ return out[i].Name < out[j].Name+ }+ return out[i].ID < out[j].ID+ })+ return out+}++// RequestStranger 向附近一台开着「所有人」的设备要它的公钥和名片,直到 ctx 结束。+func (t *Transport) RequestStranger(ctx context.Context, id string, card *pb.FriendCard) (PeerInfo, error) {+ if !t.Running() {+ return PeerInfo{}, ErrDisabled+ }+ targets := func() []netip.AddrPort {+ t.mu.Lock()+ defer t.mu.Unlock()+ return t.nearbyAddrsLocked(id)+ }+ if len(targets()) == 0 {+ return PeerInfo{}, ErrNotFound+ }+ req := t.selfPairInfo()+ req.Card = card+ peer, err := t.exchange(ctx, req, strangerRequest, targets, false)+ if errors.Is(err, ErrCodeClosed) {+ // 对方已经关掉了「所有人」+ return PeerInfo{}, ErrNotFound+ }+ return peer, err+}++func (t *Transport) handleStrangerRequest(ps *pb.LanPairSigned, src netip.AddrPort) {+ info, ok := t.openPairInfo(ps)+ if !ok || len(info.GetNonce()) < 8 || t.resendResponse(info.GetNonce(), src) {+ return+ }+ t.mu.Lock()+ open := t.everyone != nil+ t.mu.Unlock()+ if !open || t.opts.AcceptStranger == nil {+ t.reject(src, info.GetNonce(), "closed")+ return+ }+ peer := peerFromInfo(info, src)+ card := t.opts.AcceptStranger(peer)+ if card == nil {+ t.reject(src, info.GetNonce(), "closed")+ return+ }+ t.log.Info("「所有人」:附近的设备要给本机发文件", "peer", peer.Name, "src", src)+ t.respondPairFor(info, peer, src, IntentDevice, card)+}diff --git a/proto/gen/pasteferry/v1/daemon.pb.go b/proto/gen/pasteferry/v1/daemon.pb.goindex 4b6447f..f9f8493 100644--- a/proto/gen/pasteferry/v1/daemon.pb.go+++ b/proto/gen/pasteferry/v1/daemon.pb.go@@ -973,6 +973,10 @@ type Event struct {// *Event_TransferChanged// *Event_TransferRemoved// *Event_Navigate+ // *Event_FriendChanged+ // *Event_FriendRemoved+ // *Event_FriendRequest+ // *Event_ProfileChangedPayload isEvent_Payload `protobuf_oneof:"payload"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -1132,91 +1136,980 @@ func (x *Event) GetNavigate() string {return ""}+func (x *Event) GetFriendChanged() *Friend {+ if x != nil {+ if x, ok := x.Payload.(*Event_FriendChanged); ok {+ return x.FriendChanged+ }+ }+ return nil+}++func (x *Event) GetFriendRemoved() string {+ if x != nil {+ if x, ok := x.Payload.(*Event_FriendRemoved); ok {+ return x.FriendRemoved+ }+ }+ return ""+}++func (x *Event) GetFriendRequest() *FriendRequest {+ if x != nil {+ if x, ok := x.Payload.(*Event_FriendRequest); ok {+ return x.FriendRequest+ }+ }+ return nil+}++func (x *Event) GetProfileChanged() *Profile {+ if x != nil {+ if x, ok := x.Payload.(*Event_ProfileChanged); ok {+ return x.ProfileChanged+ }+ }+ return nil+}+type isEvent_Payload interface {isEvent_Payload()}-type Event_ClipAdded struct {- ClipAdded *ClipRecord `protobuf:"bytes,1,opt,name=clip_added,json=clipAdded,proto3,oneof"`+type Event_ClipAdded struct {+ ClipAdded *ClipRecord `protobuf:"bytes,1,opt,name=clip_added,json=clipAdded,proto3,oneof"`+}++type Event_ClipUpdated struct {+ ClipUpdated *ClipRecord `protobuf:"bytes,2,opt,name=clip_updated,json=clipUpdated,proto3,oneof"`+}++type Event_ClipRemoved struct {+ ClipRemoved string `protobuf:"bytes,3,opt,name=clip_removed,json=clipRemoved,proto3,oneof"` // clip id+}++type Event_Progress struct {+ Progress *TransferProgress `protobuf:"bytes,4,opt,name=progress,proto3,oneof"`+}++type Event_DeviceChanged struct {+ DeviceChanged *Device `protobuf:"bytes,5,opt,name=device_changed,json=deviceChanged,proto3,oneof"`+}++type Event_PermissionChanged struct {+ PermissionChanged ClipboardPermission `protobuf:"varint,6,opt,name=permission_changed,json=permissionChanged,proto3,enum=pasteferry.v1.ClipboardPermission,oneof"`+}++type Event_StatusChanged struct {+ StatusChanged *Status `protobuf:"bytes,7,opt,name=status_changed,json=statusChanged,proto3,oneof"`+}++type Event_ClipboardWritten struct {+ ClipboardWritten *ClipboardWriteResult `protobuf:"bytes,8,opt,name=clipboard_written,json=clipboardWritten,proto3,oneof"`+}++type Event_ConfigChanged struct {+ // 设置保存后推送,快捷窗口据此重新注册快捷键+ ConfigChanged *Config `protobuf:"bytes,9,opt,name=config_changed,json=configChanged,proto3,oneof"`+}++type Event_QuickPasteChanged struct {+ QuickPasteChanged *QuickPasteStatus `protobuf:"bytes,10,opt,name=quick_paste_changed,json=quickPasteChanged,proto3,oneof"`+}++type Event_TransferChanged struct {+ // 隔空传送的一批新建、状态变化或进度更新(进度 0.2 秒节流)+ TransferChanged *Transfer `protobuf:"bytes,11,opt,name=transfer_changed,json=transferChanged,proto3,oneof"`+}++type Event_TransferRemoved struct {+ TransferRemoved string `protobuf:"bytes,12,opt,name=transfer_removed,json=transferRemoved,proto3,oneof"` // transfer id+}++type Event_Navigate struct {+ // 让界面切到某一页:"send" 是隔空传送页(用户点了隔空传送的通知)。+ // 界面是被这次点击拉起来的话还没订阅,后台服务在它订阅时补发最近 15 秒内的这一条+ Navigate string `protobuf:"bytes,13,opt,name=navigate,proto3,oneof"`+}++type Event_FriendChanged struct {+ // 好友(2.6.0)+ FriendChanged *Friend `protobuf:"bytes,14,opt,name=friend_changed,json=friendChanged,proto3,oneof"`+}++type Event_FriendRemoved struct {+ FriendRemoved string `protobuf:"bytes,15,opt,name=friend_removed,json=friendRemoved,proto3,oneof"` // device id+}++type Event_FriendRequest struct {+ // 有人兑换了本机的好友码,界面弹出确认框+ FriendRequest *FriendRequest `protobuf:"bytes,16,opt,name=friend_request,json=friendRequest,proto3,oneof"`+}++type Event_ProfileChanged struct {+ ProfileChanged *Profile `protobuf:"bytes,17,opt,name=profile_changed,json=profileChanged,proto3,oneof"`+}++func (*Event_ClipAdded) isEvent_Payload() {}++func (*Event_ClipUpdated) isEvent_Payload() {}++func (*Event_ClipRemoved) isEvent_Payload() {}++func (*Event_Progress) isEvent_Payload() {}++func (*Event_DeviceChanged) isEvent_Payload() {}++func (*Event_PermissionChanged) isEvent_Payload() {}++func (*Event_StatusChanged) isEvent_Payload() {}++func (*Event_ClipboardWritten) isEvent_Payload() {}++func (*Event_ConfigChanged) isEvent_Payload() {}++func (*Event_QuickPasteChanged) isEvent_Payload() {}++func (*Event_TransferChanged) isEvent_Payload() {}++func (*Event_TransferRemoved) isEvent_Payload() {}++func (*Event_Navigate) isEvent_Payload() {}++func (*Event_FriendChanged) isEvent_Payload() {}++func (*Event_FriendRemoved) isEvent_Payload() {}++func (*Event_FriendRequest) isEvent_Payload() {}++func (*Event_ProfileChanged) isEvent_Payload() {}++type Profile struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // 实际用的名字(没设置时是系统的用户全名)+ DeviceId string `protobuf:"bytes,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`+ HasAvatar bool `protobuf:"varint,3,opt,name=has_avatar,json=hasAvatar,proto3" json:"has_avatar,omitempty"`+ AvatarHash []byte `protobuf:"bytes,4,opt,name=avatar_hash,json=avatarHash,proto3" json:"avatar_hash,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *Profile) Reset() {+ *x = Profile{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[7]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *Profile) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Profile) ProtoMessage() {}++func (x *Profile) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[7]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use Profile.ProtoReflect.Descriptor instead.+func (*Profile) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{7}+}++func (x *Profile) GetDisplayName() string {+ if x != nil {+ return x.DisplayName+ }+ return ""+}++func (x *Profile) GetDeviceId() string {+ if x != nil {+ return x.DeviceId+ }+ return ""+}++func (x *Profile) GetHasAvatar() bool {+ if x != nil {+ return x.HasAvatar+ }+ return false+}++func (x *Profile) GetAvatarHash() []byte {+ if x != nil {+ return x.AvatarHash+ }+ return nil+}++type SetDisplayNameRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // 空字符串表示恢复成系统的用户全名+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *SetDisplayNameRequest) Reset() {+ *x = SetDisplayNameRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[8]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *SetDisplayNameRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SetDisplayNameRequest) ProtoMessage() {}++func (x *SetDisplayNameRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[8]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SetDisplayNameRequest.ProtoReflect.Descriptor instead.+func (*SetDisplayNameRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{8}+}++func (x *SetDisplayNameRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++type SetAvatarRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` // 图片文件;为空时用剪贴板里的图片+ Image []byte `protobuf:"bytes,5,opt,name=image,proto3" json:"image,omitempty"` // 直接给图片数据(界面里粘贴、拖入时)+ // 裁剪区域,按原图的比例(0 到 1);都为 0 时取中间最大的正方形+ CropX float64 `protobuf:"fixed64,2,opt,name=crop_x,json=cropX,proto3" json:"crop_x,omitempty"`+ CropY float64 `protobuf:"fixed64,3,opt,name=crop_y,json=cropY,proto3" json:"crop_y,omitempty"`+ CropSize float64 `protobuf:"fixed64,4,opt,name=crop_size,json=cropSize,proto3" json:"crop_size,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *SetAvatarRequest) Reset() {+ *x = SetAvatarRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[9]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *SetAvatarRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SetAvatarRequest) ProtoMessage() {}++func (x *SetAvatarRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[9]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SetAvatarRequest.ProtoReflect.Descriptor instead.+func (*SetAvatarRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{9}+}++func (x *SetAvatarRequest) GetPath() string {+ if x != nil {+ return x.Path+ }+ return ""+}++func (x *SetAvatarRequest) GetImage() []byte {+ if x != nil {+ return x.Image+ }+ return nil+}++func (x *SetAvatarRequest) GetCropX() float64 {+ if x != nil {+ return x.CropX+ }+ return 0+}++func (x *SetAvatarRequest) GetCropY() float64 {+ if x != nil {+ return x.CropY+ }+ return 0+}++func (x *SetAvatarRequest) GetCropSize() float64 {+ if x != nil {+ return x.CropSize+ }+ return 0+}++type GetAvatarRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ DeviceId string `protobuf:"bytes,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 空表示本机+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *GetAvatarRequest) Reset() {+ *x = GetAvatarRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[10]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *GetAvatarRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*GetAvatarRequest) ProtoMessage() {}++func (x *GetAvatarRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[10]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use GetAvatarRequest.ProtoReflect.Descriptor instead.+func (*GetAvatarRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{10}+}++func (x *GetAvatarRequest) GetDeviceId() string {+ if x != nil {+ return x.DeviceId+ }+ return ""+}++type Avatar struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Jpeg []byte `protobuf:"bytes,1,opt,name=jpeg,proto3" json:"jpeg,omitempty"`+ AvatarHash []byte `protobuf:"bytes,2,opt,name=avatar_hash,json=avatarHash,proto3" json:"avatar_hash,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *Avatar) Reset() {+ *x = Avatar{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[11]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *Avatar) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Avatar) ProtoMessage() {}++func (x *Avatar) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[11]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use Avatar.ProtoReflect.Descriptor instead.+func (*Avatar) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{11}+}++func (x *Avatar) GetJpeg() []byte {+ if x != nil {+ return x.Jpeg+ }+ return nil+}++func (x *Avatar) GetAvatarHash() []byte {+ if x != nil {+ return x.AvatarHash+ }+ return nil+}++type FriendRef struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ DeviceId string `protobuf:"bytes,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *FriendRef) Reset() {+ *x = FriendRef{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[12]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *FriendRef) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*FriendRef) ProtoMessage() {}++func (x *FriendRef) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[12]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use FriendRef.ProtoReflect.Descriptor instead.+func (*FriendRef) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{12}+}++func (x *FriendRef) GetDeviceId() string {+ if x != nil {+ return x.DeviceId+ }+ return ""+}++type SetFriendAutoAcceptRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ DeviceId string `protobuf:"bytes,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`+ AutoAccept bool `protobuf:"varint,2,opt,name=auto_accept,json=autoAccept,proto3" json:"auto_accept,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *SetFriendAutoAcceptRequest) Reset() {+ *x = SetFriendAutoAcceptRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[13]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *SetFriendAutoAcceptRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SetFriendAutoAcceptRequest) ProtoMessage() {}++func (x *SetFriendAutoAcceptRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[13]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SetFriendAutoAcceptRequest.ProtoReflect.Descriptor instead.+func (*SetFriendAutoAcceptRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{13}+}++func (x *SetFriendAutoAcceptRequest) GetDeviceId() string {+ if x != nil {+ return x.DeviceId+ }+ return ""+}++func (x *SetFriendAutoAcceptRequest) GetAutoAccept() bool {+ if x != nil {+ return x.AutoAccept+ }+ return false+}++// 好友就是对方的一台电脑+type Friend struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`+ DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`+ DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"`+ Platform string `protobuf:"bytes,4,opt,name=platform,proto3" json:"platform,omitempty"`+ Online bool `protobuf:"varint,5,opt,name=online,proto3" json:"online,omitempty"`+ Connection ConnectionKind `protobuf:"varint,6,opt,name=connection,proto3,enum=pasteferry.v1.ConnectionKind" json:"connection,omitempty"`+ LanReachable bool `protobuf:"varint,7,opt,name=lan_reachable,json=lanReachable,proto3" json:"lan_reachable,omitempty"`+ // 与 Device 相同:已经知道对方支持哪些功能+ FeaturesKnown bool `protobuf:"varint,8,opt,name=features_known,json=featuresKnown,proto3" json:"features_known,omitempty"`+ // 对方能接收好友发来的文件(声明了 send_files_ask_v1 且没有选「均不允许」)+ ReceivesFiles bool `protobuf:"varint,9,opt,name=receives_files,json=receivesFiles,proto3" json:"receives_files,omitempty"`+ // 对方选了「均不允许」+ ReceiveDisabled bool `protobuf:"varint,10,opt,name=receive_disabled,json=receiveDisabled,proto3" json:"receive_disabled,omitempty"`+ AppVersion string `protobuf:"bytes,11,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty"`+ AutoAccept bool `protobuf:"varint,12,opt,name=auto_accept,json=autoAccept,proto3" json:"auto_accept,omitempty"`+ AddedAtUnix int64 `protobuf:"varint,13,opt,name=added_at_unix,json=addedAtUnix,proto3" json:"added_at_unix,omitempty"`+ LastActivityUnix int64 `protobuf:"varint,14,opt,name=last_activity_unix,json=lastActivityUnix,proto3" json:"last_activity_unix,omitempty"`+ // 连不上的原因,见 design/friends-send.md 第 9.2 节:+ // ""(不用提示)、"self_no_service"(本机没开服务)、"peer_no_service"(对方没开服务)、+ // "different_server"(两边用的不是同一台服务器)+ Reachability string `protobuf:"bytes,15,opt,name=reachability,proto3" json:"reachability,omitempty"`+ HasAvatar bool `protobuf:"varint,16,opt,name=has_avatar,json=hasAvatar,proto3" json:"has_avatar,omitempty"`+ AvatarHash []byte `protobuf:"bytes,17,opt,name=avatar_hash,json=avatarHash,proto3" json:"avatar_hash,omitempty"`+ Fingerprint string `protobuf:"bytes,18,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *Friend) Reset() {+ *x = Friend{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[14]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *Friend) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Friend) ProtoMessage() {}++func (x *Friend) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[14]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use Friend.ProtoReflect.Descriptor instead.+func (*Friend) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{14}+}++func (x *Friend) GetId() string {+ if x != nil {+ return x.Id+ }+ return ""+}++func (x *Friend) GetDisplayName() string {+ if x != nil {+ return x.DisplayName+ }+ return ""+}++func (x *Friend) GetDeviceName() string {+ if x != nil {+ return x.DeviceName+ }+ return ""+}++func (x *Friend) GetPlatform() string {+ if x != nil {+ return x.Platform+ }+ return ""+}++func (x *Friend) GetOnline() bool {+ if x != nil {+ return x.Online+ }+ return false+}++func (x *Friend) GetConnection() ConnectionKind {+ if x != nil {+ return x.Connection+ }+ return ConnectionKind_CONNECTION_KIND_UNSPECIFIED+}++func (x *Friend) GetLanReachable() bool {+ if x != nil {+ return x.LanReachable+ }+ return false+}++func (x *Friend) GetFeaturesKnown() bool {+ if x != nil {+ return x.FeaturesKnown+ }+ return false+}++func (x *Friend) GetReceivesFiles() bool {+ if x != nil {+ return x.ReceivesFiles+ }+ return false+}++func (x *Friend) GetReceiveDisabled() bool {+ if x != nil {+ return x.ReceiveDisabled+ }+ return false+}++func (x *Friend) GetAppVersion() string {+ if x != nil {+ return x.AppVersion+ }+ return ""+}++func (x *Friend) GetAutoAccept() bool {+ if x != nil {+ return x.AutoAccept+ }+ return false+}++func (x *Friend) GetAddedAtUnix() int64 {+ if x != nil {+ return x.AddedAtUnix+ }+ return 0+}++func (x *Friend) GetLastActivityUnix() int64 {+ if x != nil {+ return x.LastActivityUnix+ }+ return 0+}++func (x *Friend) GetReachability() string {+ if x != nil {+ return x.Reachability+ }+ return ""+}++func (x *Friend) GetHasAvatar() bool {+ if x != nil {+ return x.HasAvatar+ }+ return false+}++func (x *Friend) GetAvatarHash() []byte {+ if x != nil {+ return x.AvatarHash+ }+ return nil+}++func (x *Friend) GetFingerprint() string {+ if x != nil {+ return x.Fingerprint+ }+ return ""+}++type ListFriendsResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Friends []*Friend `protobuf:"bytes,1,rep,name=friends,proto3" json:"friends,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ListFriendsResponse) Reset() {+ *x = ListFriendsResponse{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ListFriendsResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ListFriendsResponse) ProtoMessage() {}++func (x *ListFriendsResponse) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ListFriendsResponse.ProtoReflect.Descriptor instead.+func (*ListFriendsResponse) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{15}+}++func (x *ListFriendsResponse) GetFriends() []*Friend {+ if x != nil {+ return x.Friends+ }+ return nil+}++// 加好友时等待用户确认的对方信息+type FriendRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Session string `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"`+ DeviceId string `protobuf:"bytes,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`+ DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`+ DeviceName string `protobuf:"bytes,4,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"`+ Platform string `protobuf:"bytes,5,opt,name=platform,proto3" json:"platform,omitempty"`+ // 两边的安全指纹,面对面时可以核对+ Fingerprint string `protobuf:"bytes,6,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"`+ SelfFingerprint string `protobuf:"bytes,7,opt,name=self_fingerprint,json=selfFingerprint,proto3" json:"self_fingerprint,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *FriendRequest) Reset() {+ *x = FriendRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *FriendRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*FriendRequest) ProtoMessage() {}++func (x *FriendRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use FriendRequest.ProtoReflect.Descriptor instead.+func (*FriendRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{16}}-type Event_ClipUpdated struct {- ClipUpdated *ClipRecord `protobuf:"bytes,2,opt,name=clip_updated,json=clipUpdated,proto3,oneof"`+func (x *FriendRequest) GetSession() string {+ if x != nil {+ return x.Session+ }+ return ""}-type Event_ClipRemoved struct {- ClipRemoved string `protobuf:"bytes,3,opt,name=clip_removed,json=clipRemoved,proto3,oneof"` // clip id+func (x *FriendRequest) GetDeviceId() string {+ if x != nil {+ return x.DeviceId+ }+ return ""}-type Event_Progress struct {- Progress *TransferProgress `protobuf:"bytes,4,opt,name=progress,proto3,oneof"`+func (x *FriendRequest) GetDisplayName() string {+ if x != nil {+ return x.DisplayName+ }+ return ""}-type Event_DeviceChanged struct {- DeviceChanged *Device `protobuf:"bytes,5,opt,name=device_changed,json=deviceChanged,proto3,oneof"`+func (x *FriendRequest) GetDeviceName() string {+ if x != nil {+ return x.DeviceName+ }+ return ""}-type Event_PermissionChanged struct {- PermissionChanged ClipboardPermission `protobuf:"varint,6,opt,name=permission_changed,json=permissionChanged,proto3,enum=pasteferry.v1.ClipboardPermission,oneof"`+func (x *FriendRequest) GetPlatform() string {+ if x != nil {+ return x.Platform+ }+ return ""}-type Event_StatusChanged struct {- StatusChanged *Status `protobuf:"bytes,7,opt,name=status_changed,json=statusChanged,proto3,oneof"`+func (x *FriendRequest) GetFingerprint() string {+ if x != nil {+ return x.Fingerprint+ }+ return ""}-type Event_ClipboardWritten struct {- ClipboardWritten *ClipboardWriteResult `protobuf:"bytes,8,opt,name=clipboard_written,json=clipboardWritten,proto3,oneof"`+func (x *FriendRequest) GetSelfFingerprint() string {+ if x != nil {+ return x.SelfFingerprint+ }+ return ""}-type Event_ConfigChanged struct {- // 设置保存后推送,快捷窗口据此重新注册快捷键- ConfigChanged *Config `protobuf:"bytes,9,opt,name=config_changed,json=configChanged,proto3,oneof"`+// 附近开着「所有人」的陌生设备+type Stranger struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`+ DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`+ DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"`+ Platform string `protobuf:"bytes,4,opt,name=platform,proto3" json:"platform,omitempty"`+ ReceivesFiles bool `protobuf:"varint,5,opt,name=receives_files,json=receivesFiles,proto3" json:"receives_files,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}-type Event_QuickPasteChanged struct {- QuickPasteChanged *QuickPasteStatus `protobuf:"bytes,10,opt,name=quick_paste_changed,json=quickPasteChanged,proto3,oneof"`+func (x *Stranger) Reset() {+ *x = Stranger{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)}-type Event_TransferChanged struct {- // 隔空传送的一批新建、状态变化或进度更新(进度 0.2 秒节流)- TransferChanged *Transfer `protobuf:"bytes,11,opt,name=transfer_changed,json=transferChanged,proto3,oneof"`+func (x *Stranger) String() string {+ return protoimpl.X.MessageStringOf(x)}-type Event_TransferRemoved struct {- TransferRemoved string `protobuf:"bytes,12,opt,name=transfer_removed,json=transferRemoved,proto3,oneof"` // transfer id-}+func (*Stranger) ProtoMessage() {}-type Event_Navigate struct {- // 让界面切到某一页:"send" 是隔空传送页(用户点了隔空传送的通知)。- // 界面是被这次点击拉起来的话还没订阅,后台服务在它订阅时补发最近 15 秒内的这一条- Navigate string `protobuf:"bytes,13,opt,name=navigate,proto3,oneof"`+func (x *Stranger) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)}-func (*Event_ClipAdded) isEvent_Payload() {}+// Deprecated: Use Stranger.ProtoReflect.Descriptor instead.+func (*Stranger) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{17}+}-func (*Event_ClipUpdated) isEvent_Payload() {}+func (x *Stranger) GetId() string {+ if x != nil {+ return x.Id+ }+ return ""+}-func (*Event_ClipRemoved) isEvent_Payload() {}+func (x *Stranger) GetDisplayName() string {+ if x != nil {+ return x.DisplayName+ }+ return ""+}-func (*Event_Progress) isEvent_Payload() {}+func (x *Stranger) GetDeviceName() string {+ if x != nil {+ return x.DeviceName+ }+ return ""+}-func (*Event_DeviceChanged) isEvent_Payload() {}+func (x *Stranger) GetPlatform() string {+ if x != nil {+ return x.Platform+ }+ return ""+}-func (*Event_PermissionChanged) isEvent_Payload() {}+func (x *Stranger) GetReceivesFiles() bool {+ if x != nil {+ return x.ReceivesFiles+ }+ return false+}-func (*Event_StatusChanged) isEvent_Payload() {}+type Strangers struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Strangers []*Stranger `protobuf:"bytes,1,rep,name=strangers,proto3" json:"strangers,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}-func (*Event_ClipboardWritten) isEvent_Payload() {}+func (x *Strangers) Reset() {+ *x = Strangers{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}-func (*Event_ConfigChanged) isEvent_Payload() {}+func (x *Strangers) String() string {+ return protoimpl.X.MessageStringOf(x)+}-func (*Event_QuickPasteChanged) isEvent_Payload() {}+func (*Strangers) ProtoMessage() {}-func (*Event_TransferChanged) isEvent_Payload() {}+func (x *Strangers) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}-func (*Event_TransferRemoved) isEvent_Payload() {}+// Deprecated: Use Strangers.ProtoReflect.Descriptor instead.+func (*Strangers) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{18}+}-func (*Event_Navigate) isEvent_Payload() {}+func (x *Strangers) GetStrangers() []*Stranger {+ if x != nil {+ return x.Strangers+ }+ return nil+}type NotificationStatus struct {state protoimpl.MessageState `protogen:"open.v1"`@@ -1230,7 +2123,7 @@ type NotificationStatus struct {func (x *NotificationStatus) Reset() {*x = NotificationStatus{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[7]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1242,7 +2135,7 @@ func (x *NotificationStatus) String() string {func (*NotificationStatus) ProtoMessage() {}func (x *NotificationStatus) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[7]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1255,7 +2148,7 @@ func (x *NotificationStatus) ProtoReflect() protoreflect.Message {// Deprecated: Use NotificationStatus.ProtoReflect.Descriptor instead.func (*NotificationStatus) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{7}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{19}}func (x *NotificationStatus) GetSupported() bool {@@ -1289,7 +2182,7 @@ type NotificationAction struct {func (x *NotificationAction) Reset() {*x = NotificationAction{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[8]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1301,7 +2194,7 @@ func (x *NotificationAction) String() string {func (*NotificationAction) ProtoMessage() {}func (x *NotificationAction) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[8]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1314,7 +2207,7 @@ func (x *NotificationAction) ProtoReflect() protoreflect.Message {// Deprecated: Use NotificationAction.ProtoReflect.Descriptor instead.func (*NotificationAction) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{8}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{20}}func (x *NotificationAction) GetClipId() string {@@ -1343,7 +2236,7 @@ type ClipboardWriteResult struct {func (x *ClipboardWriteResult) Reset() {*x = ClipboardWriteResult{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[9]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1355,7 +2248,7 @@ func (x *ClipboardWriteResult) String() string {func (*ClipboardWriteResult) ProtoMessage() {}func (x *ClipboardWriteResult) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[9]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1368,7 +2261,7 @@ func (x *ClipboardWriteResult) ProtoReflect() protoreflect.Message {// Deprecated: Use ClipboardWriteResult.ProtoReflect.Descriptor instead.func (*ClipboardWriteResult) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{9}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{21}}func (x *ClipboardWriteResult) GetClipId() string {@@ -1411,7 +2304,7 @@ type ListHistoryRequest struct {func (x *ListHistoryRequest) Reset() {*x = ListHistoryRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[10]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1423,7 +2316,7 @@ func (x *ListHistoryRequest) String() string {func (*ListHistoryRequest) ProtoMessage() {}func (x *ListHistoryRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[10]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1436,7 +2329,7 @@ func (x *ListHistoryRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListHistoryRequest.ProtoReflect.Descriptor instead.func (*ListHistoryRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{10}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{22}}func (x *ListHistoryRequest) GetLimit() int32 {@@ -1492,7 +2385,7 @@ type ListHistoryResponse struct {func (x *ListHistoryResponse) Reset() {*x = ListHistoryResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[11]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1504,7 +2397,7 @@ func (x *ListHistoryResponse) String() string {func (*ListHistoryResponse) ProtoMessage() {}func (x *ListHistoryResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[11]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1517,7 +2410,7 @@ func (x *ListHistoryResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListHistoryResponse.ProtoReflect.Descriptor instead.func (*ListHistoryResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{11}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{23}}func (x *ListHistoryResponse) GetRecords() []*ClipRecord {@@ -1544,7 +2437,7 @@ type DeleteHistoryRequest struct {func (x *DeleteHistoryRequest) Reset() {*x = DeleteHistoryRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[12]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1556,7 +2449,7 @@ func (x *DeleteHistoryRequest) String() string {func (*DeleteHistoryRequest) ProtoMessage() {}func (x *DeleteHistoryRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[12]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1569,7 +2462,7 @@ func (x *DeleteHistoryRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeleteHistoryRequest.ProtoReflect.Descriptor instead.func (*DeleteHistoryRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{12}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{24}}func (x *DeleteHistoryRequest) GetIds() []string {@@ -1596,7 +2489,7 @@ type FetchRequest struct {func (x *FetchRequest) Reset() {*x = FetchRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[13]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1608,7 +2501,7 @@ func (x *FetchRequest) String() string {func (*FetchRequest) ProtoMessage() {}func (x *FetchRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[13]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1621,7 +2514,7 @@ func (x *FetchRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead.func (*FetchRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{13}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{25}}func (x *FetchRequest) GetClipId() string {@@ -1649,7 +2542,7 @@ type ApplyToClipboardRequest struct {func (x *ApplyToClipboardRequest) Reset() {*x = ApplyToClipboardRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[14]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1661,7 +2554,7 @@ func (x *ApplyToClipboardRequest) String() string {func (*ApplyToClipboardRequest) ProtoMessage() {}func (x *ApplyToClipboardRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[14]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1674,7 +2567,7 @@ func (x *ApplyToClipboardRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ApplyToClipboardRequest.ProtoReflect.Descriptor instead.func (*ApplyToClipboardRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{14}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{26}}func (x *ApplyToClipboardRequest) GetClipId() string {@@ -1702,7 +2595,7 @@ type SetFavoriteRequest struct {func (x *SetFavoriteRequest) Reset() {*x = SetFavoriteRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1714,7 +2607,7 @@ func (x *SetFavoriteRequest) String() string {func (*SetFavoriteRequest) ProtoMessage() {}func (x *SetFavoriteRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1727,7 +2620,7 @@ func (x *SetFavoriteRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SetFavoriteRequest.ProtoReflect.Descriptor instead.func (*SetFavoriteRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{15}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{27}}func (x *SetFavoriteRequest) GetClipId() string {@@ -1754,7 +2647,7 @@ type SetAliasRequest struct {func (x *SetAliasRequest) Reset() {*x = SetAliasRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1766,7 +2659,7 @@ func (x *SetAliasRequest) String() string {func (*SetAliasRequest) ProtoMessage() {}func (x *SetAliasRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1779,7 +2672,7 @@ func (x *SetAliasRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SetAliasRequest.ProtoReflect.Descriptor instead.func (*SetAliasRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{16}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{28}}func (x *SetAliasRequest) GetClipId() string {@@ -1805,7 +2698,7 @@ type GetClipDetailRequest struct {func (x *GetClipDetailRequest) Reset() {*x = GetClipDetailRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1817,7 +2710,7 @@ func (x *GetClipDetailRequest) String() string {func (*GetClipDetailRequest) ProtoMessage() {}func (x *GetClipDetailRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1830,7 +2723,7 @@ func (x *GetClipDetailRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetClipDetailRequest.ProtoReflect.Descriptor instead.func (*GetClipDetailRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{17}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{29}}func (x *GetClipDetailRequest) GetClipId() string {@@ -1854,7 +2747,7 @@ type ClipDetail struct {func (x *ClipDetail) Reset() {*x = ClipDetail{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1866,7 +2759,7 @@ func (x *ClipDetail) String() string {func (*ClipDetail) ProtoMessage() {}func (x *ClipDetail) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1879,7 +2772,7 @@ func (x *ClipDetail) ProtoReflect() protoreflect.Message {// Deprecated: Use ClipDetail.ProtoReflect.Descriptor instead.func (*ClipDetail) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{18}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{30}}func (x *ClipDetail) GetText() string {@@ -1927,7 +2820,7 @@ type QuickPasteStatus struct {func (x *QuickPasteStatus) Reset() {*x = QuickPasteStatus{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1939,7 +2832,7 @@ func (x *QuickPasteStatus) String() string {func (*QuickPasteStatus) ProtoMessage() {}func (x *QuickPasteStatus) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1952,7 +2845,7 @@ func (x *QuickPasteStatus) ProtoReflect() protoreflect.Message {// Deprecated: Use QuickPasteStatus.ProtoReflect.Descriptor instead.func (*QuickPasteStatus) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{19}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{31}}func (x *QuickPasteStatus) GetRunning() bool {@@ -2016,7 +2909,7 @@ type QuickPasteCommand struct {func (x *QuickPasteCommand) Reset() {*x = QuickPasteCommand{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2028,7 +2921,7 @@ func (x *QuickPasteCommand) String() string {func (*QuickPasteCommand) ProtoMessage() {}func (x *QuickPasteCommand) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2041,7 +2934,7 @@ func (x *QuickPasteCommand) ProtoReflect() protoreflect.Message {// Deprecated: Use QuickPasteCommand.ProtoReflect.Descriptor instead.func (*QuickPasteCommand) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{20}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{32}}func (x *QuickPasteCommand) GetCommand() string {@@ -2061,7 +2954,7 @@ type ListDevicesResponse struct {func (x *ListDevicesResponse) Reset() {*x = ListDevicesResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2073,7 +2966,7 @@ func (x *ListDevicesResponse) String() string {func (*ListDevicesResponse) ProtoMessage() {}func (x *ListDevicesResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2086,7 +2979,7 @@ func (x *ListDevicesResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListDevicesResponse.ProtoReflect.Descriptor instead.func (*ListDevicesResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{21}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{33}}func (x *ListDevicesResponse) GetSelf() *Device {@@ -2116,7 +3009,7 @@ type CreatePairingCodeResponse struct {func (x *CreatePairingCodeResponse) Reset() {*x = CreatePairingCodeResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2128,7 +3021,7 @@ func (x *CreatePairingCodeResponse) String() string {func (*CreatePairingCodeResponse) ProtoMessage() {}func (x *CreatePairingCodeResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2141,7 +3034,7 @@ func (x *CreatePairingCodeResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use CreatePairingCodeResponse.ProtoReflect.Descriptor instead.func (*CreatePairingCodeResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{22}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{34}}func (x *CreatePairingCodeResponse) GetCode() string {@@ -2178,7 +3071,7 @@ type RedeemPairingCodeRequest struct {func (x *RedeemPairingCodeRequest) Reset() {*x = RedeemPairingCodeRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2190,7 +3083,7 @@ func (x *RedeemPairingCodeRequest) String() string {func (*RedeemPairingCodeRequest) ProtoMessage() {}func (x *RedeemPairingCodeRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2203,7 +3096,7 @@ func (x *RedeemPairingCodeRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use RedeemPairingCodeRequest.ProtoReflect.Descriptor instead.func (*RedeemPairingCodeRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{23}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{35}}func (x *RedeemPairingCodeRequest) GetCode() string {@@ -2231,7 +3124,7 @@ type RedeemPairingCodeResponse struct {func (x *RedeemPairingCodeResponse) Reset() {*x = RedeemPairingCodeResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2243,7 +3136,7 @@ func (x *RedeemPairingCodeResponse) String() string {func (*RedeemPairingCodeResponse) ProtoMessage() {}func (x *RedeemPairingCodeResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2256,7 +3149,7 @@ func (x *RedeemPairingCodeResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use RedeemPairingCodeResponse.ProtoReflect.Descriptor instead.func (*RedeemPairingCodeResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{24}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{36}}func (x *RedeemPairingCodeResponse) GetPeer() *Device {@@ -2283,7 +3176,7 @@ type ConfirmPairingRequest struct {func (x *ConfirmPairingRequest) Reset() {*x = ConfirmPairingRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2295,7 +3188,7 @@ func (x *ConfirmPairingRequest) String() string {func (*ConfirmPairingRequest) ProtoMessage() {}func (x *ConfirmPairingRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2308,7 +3201,7 @@ func (x *ConfirmPairingRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ConfirmPairingRequest.ProtoReflect.Descriptor instead.func (*ConfirmPairingRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{25}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{37}}func (x *ConfirmPairingRequest) GetPairingSession() string {@@ -2338,7 +3231,7 @@ type NearbyDevice struct {func (x *NearbyDevice) Reset() {*x = NearbyDevice{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2350,7 +3243,7 @@ func (x *NearbyDevice) String() string {func (*NearbyDevice) ProtoMessage() {}func (x *NearbyDevice) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2363,7 +3256,7 @@ func (x *NearbyDevice) ProtoReflect() protoreflect.Message {// Deprecated: Use NearbyDevice.ProtoReflect.Descriptor instead.func (*NearbyDevice) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{26}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{38}}func (x *NearbyDevice) GetId() string {@@ -2403,7 +3296,7 @@ type NearbyDevices struct {func (x *NearbyDevices) Reset() {*x = NearbyDevices{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2415,7 +3308,7 @@ func (x *NearbyDevices) String() string {func (*NearbyDevices) ProtoMessage() {}func (x *NearbyDevices) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2428,7 +3321,7 @@ func (x *NearbyDevices) ProtoReflect() protoreflect.Message {// Deprecated: Use NearbyDevices.ProtoReflect.Descriptor instead.func (*NearbyDevices) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{27}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{39}}func (x *NearbyDevices) GetDevices() []*NearbyDevice {@@ -2447,7 +3340,7 @@ type PairNearbyRequest struct {func (x *PairNearbyRequest) Reset() {*x = PairNearbyRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2459,7 +3352,7 @@ func (x *PairNearbyRequest) String() string {func (*PairNearbyRequest) ProtoMessage() {}func (x *PairNearbyRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2472,7 +3365,7 @@ func (x *PairNearbyRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PairNearbyRequest.ProtoReflect.Descriptor instead.func (*PairNearbyRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{28}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{40}}func (x *PairNearbyRequest) GetId() string {@@ -2491,7 +3384,7 @@ type UnpairRequest struct {func (x *UnpairRequest) Reset() {*x = UnpairRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2503,7 +3396,7 @@ func (x *UnpairRequest) String() string {func (*UnpairRequest) ProtoMessage() {}func (x *UnpairRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2516,7 +3409,7 @@ func (x *UnpairRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UnpairRequest.ProtoReflect.Descriptor instead.func (*UnpairRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{29}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{41}}func (x *UnpairRequest) GetDeviceId() string {@@ -2535,7 +3428,7 @@ type ReconnectRequest struct {func (x *ReconnectRequest) Reset() {*x = ReconnectRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2547,7 +3440,7 @@ func (x *ReconnectRequest) String() string {func (*ReconnectRequest) ProtoMessage() {}func (x *ReconnectRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2560,7 +3453,7 @@ func (x *ReconnectRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ReconnectRequest.ProtoReflect.Descriptor instead.func (*ReconnectRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{30}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{42}}func (x *ReconnectRequest) GetDeviceId() string {@@ -2579,7 +3472,7 @@ type ReconnectResponse struct {func (x *ReconnectResponse) Reset() {*x = ReconnectResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2591,7 +3484,7 @@ func (x *ReconnectResponse) String() string {func (*ReconnectResponse) ProtoMessage() {}func (x *ReconnectResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2604,7 +3497,7 @@ func (x *ReconnectResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ReconnectResponse.ProtoReflect.Descriptor instead.func (*ReconnectResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{31}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{43}}func (x *ReconnectResponse) GetKind() ConnectionKind {@@ -2624,7 +3517,7 @@ type SetDeviceAddressRequest struct {func (x *SetDeviceAddressRequest) Reset() {*x = SetDeviceAddressRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[44]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2636,7 +3529,7 @@ func (x *SetDeviceAddressRequest) String() string {func (*SetDeviceAddressRequest) ProtoMessage() {}func (x *SetDeviceAddressRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[44]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2649,7 +3542,7 @@ func (x *SetDeviceAddressRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SetDeviceAddressRequest.ProtoReflect.Descriptor instead.func (*SetDeviceAddressRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{32}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{44}}func (x *SetDeviceAddressRequest) GetDeviceId() string {@@ -2716,13 +3609,20 @@ type Config struct {RealtimeSyncDisabled bool `protobuf:"varint,27,opt,name=realtime_sync_disabled,json=realtimeSyncDisabled,proto3" json:"realtime_sync_disabled,omitempty"`SyncBacklog bool `protobuf:"varint,28,opt,name=sync_backlog,json=syncBacklog,proto3" json:"sync_backlog,omitempty"`SyncDisabledPeers []string `protobuf:"bytes,29,rep,name=sync_disabled_peers,json=syncDisabledPeers,proto3" json:"sync_disabled_peers,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ // 谁可以给我发文件(2.6.0):"off"(均不允许)、"friends"(仅限好友,默认)、"everyone"(所有人)。+ // 只管别人;自己设备之间的发送看 receive_disabled+ ReceiveFrom string `protobuf:"bytes,30,opt,name=receive_from,json=receiveFrom,proto3" json:"receive_from,omitempty"`+ // 「所有人」在这个时间自动回到「仅限好友」,Unix 秒。打开「所有人」时由后台服务填上+ EveryoneUntilUnix int64 `protobuf:"varint,31,opt,name=everyone_until_unix,json=everyoneUntilUnix,proto3" json:"everyone_until_unix,omitempty"`+ // 好友看到的名字,空表示系统的用户全名+ DisplayName string `protobuf:"bytes,32,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *Config) Reset() {*x = Config{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[45]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2734,7 +3634,7 @@ func (x *Config) String() string {func (*Config) ProtoMessage() {}func (x *Config) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[45]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2747,7 +3647,7 @@ func (x *Config) ProtoReflect() protoreflect.Message {// Deprecated: Use Config.ProtoReflect.Descriptor instead.func (*Config) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{33}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{45}}func (x *Config) GetAutoSyncThresholdBytes() int64 {@@ -2953,6 +3853,27 @@ func (x *Config) GetSyncDisabledPeers() []string {return nil}+func (x *Config) GetReceiveFrom() string {+ if x != nil {+ return x.ReceiveFrom+ }+ return ""+}++func (x *Config) GetEveryoneUntilUnix() int64 {+ if x != nil {+ return x.EveryoneUntilUnix+ }+ return 0+}++func (x *Config) GetDisplayName() string {+ if x != nil {+ return x.DisplayName+ }+ return ""+}+type OfficialUsage struct {state protoimpl.MessageState `protogen:"open.v1"`Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"`@@ -2971,7 +3892,7 @@ type OfficialUsage struct {func (x *OfficialUsage) Reset() {*x = OfficialUsage{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[46]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2983,7 +3904,7 @@ func (x *OfficialUsage) String() string {func (*OfficialUsage) ProtoMessage() {}func (x *OfficialUsage) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[46]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2996,7 +3917,7 @@ func (x *OfficialUsage) ProtoReflect() protoreflect.Message {// Deprecated: Use OfficialUsage.ProtoReflect.Descriptor instead.func (*OfficialUsage) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{34}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{46}}func (x *OfficialUsage) GetAvailable() bool {@@ -3084,7 +4005,7 @@ type NetworkInfo struct {func (x *NetworkInfo) Reset() {*x = NetworkInfo{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[47]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3096,7 +4017,7 @@ func (x *NetworkInfo) String() string {func (*NetworkInfo) ProtoMessage() {}func (x *NetworkInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[47]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3109,7 +4030,7 @@ func (x *NetworkInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead.func (*NetworkInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{35}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{47}}func (x *NetworkInfo) GetLocalPort() int32 {@@ -3169,7 +4090,7 @@ type LanInfo struct {func (x *LanInfo) Reset() {*x = LanInfo{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[48]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3181,7 +4102,7 @@ func (x *LanInfo) String() string {func (*LanInfo) ProtoMessage() {}func (x *LanInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[48]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3194,7 +4115,7 @@ func (x *LanInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use LanInfo.ProtoReflect.Descriptor instead.func (*LanInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{36}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{48}}func (x *LanInfo) GetEnabled() bool {@@ -3253,7 +4174,7 @@ type LanPeer struct {func (x *LanPeer) Reset() {*x = LanPeer{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[49]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3265,7 +4186,7 @@ func (x *LanPeer) String() string {func (*LanPeer) ProtoMessage() {}func (x *LanPeer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[49]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3278,7 +4199,7 @@ func (x *LanPeer) ProtoReflect() protoreflect.Message {// Deprecated: Use LanPeer.ProtoReflect.Descriptor instead.func (*LanPeer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{37}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{49}}func (x *LanPeer) GetDeviceId() string {@@ -3335,7 +4256,7 @@ type NetworkEgress struct {func (x *NetworkEgress) Reset() {*x = NetworkEgress{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[50]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3347,7 +4268,7 @@ func (x *NetworkEgress) String() string {func (*NetworkEgress) ProtoMessage() {}func (x *NetworkEgress) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[50]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3360,7 +4281,7 @@ func (x *NetworkEgress) ProtoReflect() protoreflect.Message {// Deprecated: Use NetworkEgress.ProtoReflect.Descriptor instead.func (*NetworkEgress) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{38}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{50}}func (x *NetworkEgress) GetAddress() string {@@ -3418,7 +4339,7 @@ type Status struct {func (x *Status) Reset() {*x = Status{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[51]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3430,7 +4351,7 @@ func (x *Status) String() string {func (*Status) ProtoMessage() {}func (x *Status) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[51]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3443,7 +4364,7 @@ func (x *Status) ProtoReflect() protoreflect.Message {// Deprecated: Use Status.ProtoReflect.Descriptor instead.func (*Status) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{39}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{51}}func (x *Status) GetDeviceId() string {@@ -3554,7 +4475,7 @@ type CheckForUpdateRequest struct {func (x *CheckForUpdateRequest) Reset() {*x = CheckForUpdateRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[52]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3566,7 +4487,7 @@ func (x *CheckForUpdateRequest) String() string {func (*CheckForUpdateRequest) ProtoMessage() {}func (x *CheckForUpdateRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[52]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3579,7 +4500,7 @@ func (x *CheckForUpdateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CheckForUpdateRequest.ProtoReflect.Descriptor instead.func (*CheckForUpdateRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{40}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{52}}func (x *CheckForUpdateRequest) GetLanguage() string {@@ -3601,7 +4522,7 @@ type UpdateRelease struct {func (x *UpdateRelease) Reset() {*x = UpdateRelease{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[53]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3613,7 +4534,7 @@ func (x *UpdateRelease) String() string {func (*UpdateRelease) ProtoMessage() {}func (x *UpdateRelease) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[53]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3626,7 +4547,7 @@ func (x *UpdateRelease) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateRelease.ProtoReflect.Descriptor instead.func (*UpdateRelease) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{41}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{53}}func (x *UpdateRelease) GetVersion() string {@@ -3681,7 +4602,7 @@ type UpdateInfo struct {func (x *UpdateInfo) Reset() {*x = UpdateInfo{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[54]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3693,7 +4614,7 @@ func (x *UpdateInfo) String() string {func (*UpdateInfo) ProtoMessage() {}func (x *UpdateInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[54]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3706,7 +4627,7 @@ func (x *UpdateInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateInfo.ProtoReflect.Descriptor instead.func (*UpdateInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{42}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{54}}func (x *UpdateInfo) GetCurrentVersion() string {@@ -3781,7 +4702,7 @@ type DownloadUpdateRequest struct {func (x *DownloadUpdateRequest) Reset() {*x = DownloadUpdateRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[55]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3793,7 +4714,7 @@ func (x *DownloadUpdateRequest) String() string {func (*DownloadUpdateRequest) ProtoMessage() {}func (x *DownloadUpdateRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[55]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3806,7 +4727,7 @@ func (x *DownloadUpdateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DownloadUpdateRequest.ProtoReflect.Descriptor instead.func (*DownloadUpdateRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{43}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{55}}func (x *DownloadUpdateRequest) GetVersion() string {@@ -3828,7 +4749,7 @@ type UpdateProgress struct {func (x *UpdateProgress) Reset() {*x = UpdateProgress{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[44]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[56]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3840,7 +4761,7 @@ func (x *UpdateProgress) String() string {func (*UpdateProgress) ProtoMessage() {}func (x *UpdateProgress) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[44]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[56]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3853,7 +4774,7 @@ func (x *UpdateProgress) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateProgress.ProtoReflect.Descriptor instead.func (*UpdateProgress) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{44}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{56}}func (x *UpdateProgress) GetDownloaded() int64 {@@ -3888,7 +4809,7 @@ type InstallUpdateRequest struct {func (x *InstallUpdateRequest) Reset() {*x = InstallUpdateRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[45]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[57]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3900,7 +4821,7 @@ func (x *InstallUpdateRequest) String() string {func (*InstallUpdateRequest) ProtoMessage() {}func (x *InstallUpdateRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[45]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[57]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3913,7 +4834,7 @@ func (x *InstallUpdateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use InstallUpdateRequest.ProtoReflect.Descriptor instead.func (*InstallUpdateRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{45}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{57}}func (x *InstallUpdateRequest) GetVersion() string {@@ -3943,7 +4864,7 @@ type UpdateResult struct {func (x *UpdateResult) Reset() {*x = UpdateResult{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[46]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[58]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3955,7 +4876,7 @@ func (x *UpdateResult) String() string {func (*UpdateResult) ProtoMessage() {}func (x *UpdateResult) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[46]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[58]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3968,7 +4889,7 @@ func (x *UpdateResult) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateResult.ProtoReflect.Descriptor instead.func (*UpdateResult) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{46}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{58}}func (x *UpdateResult) GetFromVersion() string {@@ -4016,7 +4937,7 @@ type ExportDiagnosticsRequest struct {func (x *ExportDiagnosticsRequest) Reset() {*x = ExportDiagnosticsRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[47]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[59]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4028,7 +4949,7 @@ func (x *ExportDiagnosticsRequest) String() string {func (*ExportDiagnosticsRequest) ProtoMessage() {}func (x *ExportDiagnosticsRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[47]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[59]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4041,7 +4962,7 @@ func (x *ExportDiagnosticsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ExportDiagnosticsRequest.ProtoReflect.Descriptor instead.func (*ExportDiagnosticsRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{47}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{59}}func (x *ExportDiagnosticsRequest) GetLogLines() int32 {@@ -4067,7 +4988,7 @@ type Diagnostics struct {func (x *Diagnostics) Reset() {*x = Diagnostics{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[48]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[60]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4079,7 +5000,7 @@ func (x *Diagnostics) String() string {func (*Diagnostics) ProtoMessage() {}func (x *Diagnostics) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[48]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[60]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4092,7 +5013,7 @@ func (x *Diagnostics) ProtoReflect() protoreflect.Message {// Deprecated: Use Diagnostics.ProtoReflect.Descriptor instead.func (*Diagnostics) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{48}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{60}}func (x *Diagnostics) GetReport() string {@@ -4111,7 +5032,7 @@ type SetVerboseLogRequest struct {func (x *SetVerboseLogRequest) Reset() {*x = SetVerboseLogRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[49]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[61]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4123,7 +5044,7 @@ func (x *SetVerboseLogRequest) String() string {func (*SetVerboseLogRequest) ProtoMessage() {}func (x *SetVerboseLogRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[49]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[61]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4136,7 +5057,7 @@ func (x *SetVerboseLogRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SetVerboseLogRequest.ProtoReflect.Descriptor instead.func (*SetVerboseLogRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{49}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{61}}func (x *SetVerboseLogRequest) GetMinutes() int32 {@@ -4156,7 +5077,7 @@ type GetImagePreviewRequest struct {func (x *GetImagePreviewRequest) Reset() {*x = GetImagePreviewRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[50]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[62]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4168,7 +5089,7 @@ func (x *GetImagePreviewRequest) String() string {func (*GetImagePreviewRequest) ProtoMessage() {}func (x *GetImagePreviewRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[50]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[62]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4181,7 +5102,7 @@ func (x *GetImagePreviewRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetImagePreviewRequest.ProtoReflect.Descriptor instead.func (*GetImagePreviewRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{50}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{62}}func (x *GetImagePreviewRequest) GetClipId() string {@@ -4209,7 +5130,7 @@ type GetImagePreviewResponse struct {func (x *GetImagePreviewResponse) Reset() {*x = GetImagePreviewResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[51]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[63]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4221,7 +5142,7 @@ func (x *GetImagePreviewResponse) String() string {func (*GetImagePreviewResponse) ProtoMessage() {}func (x *GetImagePreviewResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[51]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[63]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4234,7 +5155,7 @@ func (x *GetImagePreviewResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use GetImagePreviewResponse.ProtoReflect.Descriptor instead.func (*GetImagePreviewResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{51}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{63}}func (x *GetImagePreviewResponse) GetPath() string {@@ -4264,14 +5185,16 @@ type SendFilesRequest struct {// 拖进来或选中的文件与文件夹在本机的完整路径Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"`// 用户已确认可以经官方服务中转- AllowRelay bool `protobuf:"varint,3,opt,name=allow_relay,json=allowRelay,proto3" json:"allow_relay,omitempty"`+ AllowRelay bool `protobuf:"varint,3,opt,name=allow_relay,json=allowRelay,proto3" json:"allow_relay,omitempty"`+ // 备注,见 Transfer.note+ Note string `protobuf:"bytes,4,opt,name=note,proto3" json:"note,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}func (x *SendFilesRequest) Reset() {*x = SendFilesRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[52]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[64]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4283,7 +5206,7 @@ func (x *SendFilesRequest) String() string {func (*SendFilesRequest) ProtoMessage() {}func (x *SendFilesRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[52]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[64]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4296,7 +5219,7 @@ func (x *SendFilesRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SendFilesRequest.ProtoReflect.Descriptor instead.func (*SendFilesRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{52}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{64}}func (x *SendFilesRequest) GetDeviceId() string {@@ -4320,6 +5243,13 @@ func (x *SendFilesRequest) GetAllowRelay() bool {return false}+func (x *SendFilesRequest) GetNote() string {+ if x != nil {+ return x.Note+ }+ return ""+}+type TransferRef struct {state protoimpl.MessageState `protogen:"open.v1"`Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`@@ -4329,7 +5259,7 @@ type TransferRef struct {func (x *TransferRef) Reset() {*x = TransferRef{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[53]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[65]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4341,7 +5271,7 @@ func (x *TransferRef) String() string {func (*TransferRef) ProtoMessage() {}func (x *TransferRef) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[53]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[65]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4354,7 +5284,7 @@ func (x *TransferRef) ProtoReflect() protoreflect.Message {// Deprecated: Use TransferRef.ProtoReflect.Descriptor instead.func (*TransferRef) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{53}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{65}}func (x *TransferRef) GetId() string {@@ -4381,6 +5311,7 @@ type Transfer struct {FileCount int64 `protobuf:"varint,10,opt,name=file_count,json=fileCount,proto3" json:"file_count,omitempty"`BytesPerSecond float64 `protobuf:"fixed64,11,opt,name=bytes_per_second,json=bytesPerSecond,proto3" json:"bytes_per_second,omitempty"`// 失败、回绝、取消的原因,固定代码,界面翻译:no_space、dest_unavailable、+ // declined(对方拒绝)、timeout(对方没有回应)、not_allowed(对方不接收)、// file_too_large、disabled、unsupported、offline、source_changed、source_missing、// read_error、write_failed、hash_mismatch、cancelled、peer_cancelled、relay_quota 等Error string `protobuf:"bytes,12,opt,name=error,proto3" json:"error,omitempty"`@@ -4396,14 +5327,20 @@ type Transfer struct {Present []bool `protobuf:"varint,21,rep,packed,name=present,proto3" json:"present,omitempty"`// 收到的:文件名里有本机文件系统不允许的字符、改过名的文件数。只有 Windows 上会有:// : * ? " < > | \ 换成相近的全角字符,见 pack/names.go。文件内容不受影响- RenamedFiles int64 `protobuf:"varint,22,opt,name=renamed_files,json=renamedFiles,proto3" json:"renamed_files,omitempty"`+ RenamedFiles int64 `protobuf:"varint,22,opt,name=renamed_files,json=renamedFiles,proto3" json:"renamed_files,omitempty"`+ // 对方是谁(2.6.0):"self"(自己的设备)、"friend"、"stranger"(「所有人」模式下的陌生设备)+ PeerRole string `protobuf:"bytes,23,opt,name=peer_role,json=peerRole,proto3" json:"peer_role,omitempty"`+ // 备注+ Note string `protobuf:"bytes,24,opt,name=note,proto3" json:"note,omitempty"`+ // 收到的图片的缩略图(本机重新编码过的 PNG),与 items 一一对应,不是图片的为空+ Thumbs []string `protobuf:"bytes,25,rep,name=thumbs,proto3" json:"thumbs,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}func (x *Transfer) Reset() {*x = Transfer{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[54]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[66]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4415,7 +5352,7 @@ func (x *Transfer) String() string {func (*Transfer) ProtoMessage() {}func (x *Transfer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[54]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[66]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4428,7 +5365,7 @@ func (x *Transfer) ProtoReflect() protoreflect.Message {// Deprecated: Use Transfer.ProtoReflect.Descriptor instead.func (*Transfer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{54}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{66}}func (x *Transfer) GetId() string {@@ -4585,6 +5522,88 @@ func (x *Transfer) GetRenamedFiles() int64 {return 0}+func (x *Transfer) GetPeerRole() string {+ if x != nil {+ return x.PeerRole+ }+ return ""+}++func (x *Transfer) GetNote() string {+ if x != nil {+ return x.Note+ }+ return ""+}++func (x *Transfer) GetThumbs() []string {+ if x != nil {+ return x.Thumbs+ }+ return nil+}++type AnswerIncomingRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ TransferId string `protobuf:"bytes,1,opt,name=transfer_id,json=transferId,proto3" json:"transfer_id,omitempty"`+ Accept bool `protobuf:"varint,2,opt,name=accept,proto3" json:"accept,omitempty"`+ // 以后自动接收这个好友的文件(陌生设备忽略)+ Always bool `protobuf:"varint,3,opt,name=always,proto3" json:"always,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *AnswerIncomingRequest) Reset() {+ *x = AnswerIncomingRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[67]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *AnswerIncomingRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*AnswerIncomingRequest) ProtoMessage() {}++func (x *AnswerIncomingRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[67]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use AnswerIncomingRequest.ProtoReflect.Descriptor instead.+func (*AnswerIncomingRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{67}+}++func (x *AnswerIncomingRequest) GetTransferId() string {+ if x != nil {+ return x.TransferId+ }+ return ""+}++func (x *AnswerIncomingRequest) GetAccept() bool {+ if x != nil {+ return x.Accept+ }+ return false+}++func (x *AnswerIncomingRequest) GetAlways() bool {+ if x != nil {+ return x.Always+ }+ return false+}+type ListTransfersRequest struct {state protoimpl.MessageState `protogen:"open.v1"`Direction TransferDirection `protobuf:"varint,1,opt,name=direction,proto3,enum=pasteferry.v1.TransferDirection" json:"direction,omitempty"` // UNSPECIFIED 表示两类都要@@ -4596,7 +5615,7 @@ type ListTransfersRequest struct {func (x *ListTransfersRequest) Reset() {*x = ListTransfersRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[55]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[68]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4608,7 +5627,7 @@ func (x *ListTransfersRequest) String() string {func (*ListTransfersRequest) ProtoMessage() {}func (x *ListTransfersRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[55]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[68]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4621,7 +5640,7 @@ func (x *ListTransfersRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListTransfersRequest.ProtoReflect.Descriptor instead.func (*ListTransfersRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{55}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{68}}func (x *ListTransfersRequest) GetDirection() TransferDirection {@@ -4654,7 +5673,7 @@ type ListTransfersResponse struct {func (x *ListTransfersResponse) Reset() {*x = ListTransfersResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[56]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[69]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4666,7 +5685,7 @@ func (x *ListTransfersResponse) String() string {func (*ListTransfersResponse) ProtoMessage() {}func (x *ListTransfersResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[56]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[69]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4679,7 +5698,7 @@ func (x *ListTransfersResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListTransfersResponse.ProtoReflect.Descriptor instead.func (*ListTransfersResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{56}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{69}}func (x *ListTransfersResponse) GetTransfers() []*Transfer {@@ -4700,7 +5719,7 @@ type DeleteTransfersRequest struct {func (x *DeleteTransfersRequest) Reset() {*x = DeleteTransfersRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[57]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[70]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4712,7 +5731,7 @@ func (x *DeleteTransfersRequest) String() string {func (*DeleteTransfersRequest) ProtoMessage() {}func (x *DeleteTransfersRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[57]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[70]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4725,7 +5744,7 @@ func (x *DeleteTransfersRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeleteTransfersRequest.ProtoReflect.Descriptor instead.func (*DeleteTransfersRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{57}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{70}}func (x *DeleteTransfersRequest) GetIds() []string {@@ -4758,7 +5777,7 @@ type CheckReceiveDirRequest struct {func (x *CheckReceiveDirRequest) Reset() {*x = CheckReceiveDirRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[58]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[71]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4770,7 +5789,7 @@ func (x *CheckReceiveDirRequest) String() string {func (*CheckReceiveDirRequest) ProtoMessage() {}func (x *CheckReceiveDirRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[58]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[71]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4783,7 +5802,7 @@ func (x *CheckReceiveDirRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CheckReceiveDirRequest.ProtoReflect.Descriptor instead.func (*CheckReceiveDirRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{58}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{71}}func (x *CheckReceiveDirRequest) GetPath() string {@@ -4807,7 +5826,7 @@ type CheckReceiveDirResponse struct {func (x *CheckReceiveDirResponse) Reset() {*x = CheckReceiveDirResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[59]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[72]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -4819,7 +5838,7 @@ func (x *CheckReceiveDirResponse) String() string {func (*CheckReceiveDirResponse) ProtoMessage() {}func (x *CheckReceiveDirResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[59]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[72]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -4832,7 +5851,7 @@ func (x *CheckReceiveDirResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use CheckReceiveDirResponse.ProtoReflect.Descriptor instead.func (*CheckReceiveDirResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{59}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{72}}func (x *CheckReceiveDirResponse) GetOk() bool {@@ -4922,7 +5941,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\rlan_reachable\x18\v \x01(\bR\flanReachable\x12%\n" +"\x0efeatures_known\x18\f \x01(\bR\rfeaturesKnown\x12\x1f\n" +"\vapp_version\x18\r \x01(\tR\n" +- "appVersion\"\xbf\x06\n" ++ "appVersion\"\xb2\b\n" +"\x05Event\x12:\n" +"\n" +"clip_added\x18\x01 \x01(\v2\x19.pasteferry.v1.ClipRecordH\x00R\tclipAdded\x12>\n" +@@ -4938,8 +5957,86 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +" \x01(\v2\x1f.pasteferry.v1.QuickPasteStatusH\x00R\x11quickPasteChanged\x12D\n" +"\x10transfer_changed\x18\v \x01(\v2\x17.pasteferry.v1.TransferH\x00R\x0ftransferChanged\x12+\n" +"\x10transfer_removed\x18\f \x01(\tH\x00R\x0ftransferRemoved\x12\x1c\n" +- "\bnavigate\x18\r \x01(\tH\x00R\bnavigateB\t\n" +- "\apayload\"\x7f\n" ++ "\bnavigate\x18\r \x01(\tH\x00R\bnavigate\x12>\n" ++ "\x0efriend_changed\x18\x0e \x01(\v2\x15.pasteferry.v1.FriendH\x00R\rfriendChanged\x12'\n" ++ "\x0efriend_removed\x18\x0f \x01(\tH\x00R\rfriendRemoved\x12E\n" ++ "\x0efriend_request\x18\x10 \x01(\v2\x1c.pasteferry.v1.FriendRequestH\x00R\rfriendRequest\x12A\n" ++ "\x0fprofile_changed\x18\x11 \x01(\v2\x16.pasteferry.v1.ProfileH\x00R\x0eprofileChangedB\t\n" ++ "\apayload\"\x89\x01\n" ++ "\aProfile\x12!\n" ++ "\fdisplay_name\x18\x01 \x01(\tR\vdisplayName\x12\x1b\n" ++ "\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12\x1d\n" ++ "\n" ++ "has_avatar\x18\x03 \x01(\bR\thasAvatar\x12\x1f\n" ++ "\vavatar_hash\x18\x04 \x01(\fR\n" ++ "avatarHash\"+\n" ++ "\x15SetDisplayNameRequest\x12\x12\n" ++ "\x04name\x18\x01 \x01(\tR\x04name\"\x87\x01\n" ++ "\x10SetAvatarRequest\x12\x12\n" ++ "\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n" ++ "\x05image\x18\x05 \x01(\fR\x05image\x12\x15\n" ++ "\x06crop_x\x18\x02 \x01(\x01R\x05cropX\x12\x15\n" ++ "\x06crop_y\x18\x03 \x01(\x01R\x05cropY\x12\x1b\n" ++ "\tcrop_size\x18\x04 \x01(\x01R\bcropSize\"/\n" ++ "\x10GetAvatarRequest\x12\x1b\n" ++ "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\"=\n" ++ "\x06Avatar\x12\x12\n" ++ "\x04jpeg\x18\x01 \x01(\fR\x04jpeg\x12\x1f\n" ++ "\vavatar_hash\x18\x02 \x01(\fR\n" ++ "avatarHash\"(\n" ++ "\tFriendRef\x12\x1b\n" ++ "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\"Z\n" ++ "\x1aSetFriendAutoAcceptRequest\x12\x1b\n" ++ "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\x12\x1f\n" ++ "\vauto_accept\x18\x02 \x01(\bR\n" ++ "autoAccept\"\x87\x05\n" ++ "\x06Friend\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" ++ "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1f\n" ++ "\vdevice_name\x18\x03 \x01(\tR\n" ++ "deviceName\x12\x1a\n" ++ "\bplatform\x18\x04 \x01(\tR\bplatform\x12\x16\n" ++ "\x06online\x18\x05 \x01(\bR\x06online\x12=\n" ++ "\n" ++ "connection\x18\x06 \x01(\x0e2\x1d.pasteferry.v1.ConnectionKindR\n" ++ "connection\x12#\n" ++ "\rlan_reachable\x18\a \x01(\bR\flanReachable\x12%\n" ++ "\x0efeatures_known\x18\b \x01(\bR\rfeaturesKnown\x12%\n" ++ "\x0ereceives_files\x18\t \x01(\bR\rreceivesFiles\x12)\n" ++ "\x10receive_disabled\x18\n" ++ " \x01(\bR\x0freceiveDisabled\x12\x1f\n" ++ "\vapp_version\x18\v \x01(\tR\n" ++ "appVersion\x12\x1f\n" ++ "\vauto_accept\x18\f \x01(\bR\n" ++ "autoAccept\x12\"\n" ++ "\radded_at_unix\x18\r \x01(\x03R\vaddedAtUnix\x12,\n" ++ "\x12last_activity_unix\x18\x0e \x01(\x03R\x10lastActivityUnix\x12\"\n" ++ "\freachability\x18\x0f \x01(\tR\freachability\x12\x1d\n" ++ "\n" ++ "has_avatar\x18\x10 \x01(\bR\thasAvatar\x12\x1f\n" ++ "\vavatar_hash\x18\x11 \x01(\fR\n" ++ "avatarHash\x12 \n" ++ "\vfingerprint\x18\x12 \x01(\tR\vfingerprint\"F\n" ++ "\x13ListFriendsResponse\x12/\n" ++ "\afriends\x18\x01 \x03(\v2\x15.pasteferry.v1.FriendR\afriends\"\xf3\x01\n" ++ "\rFriendRequest\x12\x18\n" ++ "\asession\x18\x01 \x01(\tR\asession\x12\x1b\n" ++ "\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12!\n" ++ "\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12\x1f\n" ++ "\vdevice_name\x18\x04 \x01(\tR\n" ++ "deviceName\x12\x1a\n" ++ "\bplatform\x18\x05 \x01(\tR\bplatform\x12 \n" ++ "\vfingerprint\x18\x06 \x01(\tR\vfingerprint\x12)\n" ++ "\x10self_fingerprint\x18\a \x01(\tR\x0fselfFingerprint\"\xa1\x01\n" ++ "\bStranger\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" ++ "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1f\n" ++ "\vdevice_name\x18\x03 \x01(\tR\n" ++ "deviceName\x12\x1a\n" ++ "\bplatform\x18\x04 \x01(\tR\bplatform\x12%\n" ++ "\x0ereceives_files\x18\x05 \x01(\bR\rreceivesFiles\"B\n" ++ "\tStrangers\x125\n" ++ "\tstrangers\x18\x01 \x03(\v2\x17.pasteferry.v1.StrangerR\tstrangers\"\x7f\n" +"\x12NotificationStatus\x12\x1c\n" +"\tsupported\x18\x01 \x01(\bR\tsupported\x12+\n" +"\x11actions_supported\x18\x02 \x01(\bR\x10actionsSupported\x12\x1e\n" +@@ -5033,7 +6130,8 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x04kind\x18\x01 \x01(\x0e2\x1d.pasteferry.v1.ConnectionKindR\x04kind\"P\n" +"\x17SetDeviceAddressRequest\x12\x1b\n" +"\tdevice_id\x18\x01 \x01(\tR\bdeviceId\x12\x18\n" +- "\aaddress\x18\x02 \x01(\tR\aaddress\"\xf2\t\n" ++ "\aaddress\x18\x02 \x01(\tR\aaddress\"\xe8\n" ++ "\n" +"\x06Config\x129\n" +"\x19auto_sync_threshold_bytes\x18\x01 \x01(\x03R\x16autoSyncThresholdBytes\x12.\n" +"\x13history_ttl_seconds\x18\x02 \x01(\x03R\x11historyTtlSeconds\x12*\n" +@@ -5067,7 +6165,10 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x13send_layout_stacked\x18\x1a \x01(\bR\x11sendLayoutStacked\x124\n" +"\x16realtime_sync_disabled\x18\x1b \x01(\bR\x14realtimeSyncDisabled\x12!\n" +"\fsync_backlog\x18\x1c \x01(\bR\vsyncBacklog\x12.\n" +- "\x13sync_disabled_peers\x18\x1d \x03(\tR\x11syncDisabledPeers\"\xd8\x02\n" ++ "\x13sync_disabled_peers\x18\x1d \x03(\tR\x11syncDisabledPeers\x12!\n" ++ "\freceive_from\x18\x1e \x01(\tR\vreceiveFrom\x12.\n" ++ "\x13everyone_until_unix\x18\x1f \x01(\x03R\x11everyoneUntilUnix\x12!\n" ++ "\fdisplay_name\x18 \x01(\tR\vdisplayName\"\xd8\x02\n" +"\rOfficialUsage\x12\x1c\n" +"\tavailable\x18\x01 \x01(\bR\tavailable\x12\x10\n" +"\x03day\x18\x02 \x01(\tR\x03day\x12\x1f\n" +@@ -5182,14 +6283,15 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x17GetImagePreviewResponse\x12\x12\n" +"\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n" +"\x05count\x18\x02 \x01(\x05R\x05count\x12\x12\n" +- "\x04name\x18\x03 \x01(\tR\x04name\"f\n" ++ "\x04name\x18\x03 \x01(\tR\x04name\"z\n" +"\x10SendFilesRequest\x12\x1b\n" +"\tdevice_id\x18\x01 \x01(\tR\bdeviceId\x12\x14\n" +"\x05paths\x18\x02 \x03(\tR\x05paths\x12\x1f\n" +"\vallow_relay\x18\x03 \x01(\bR\n" +- "allowRelay\"\x1d\n" ++ "allowRelay\x12\x12\n" ++ "\x04note\x18\x04 \x01(\tR\x04note\"\x1d\n" +"\vTransferRef\x12\x0e\n" +- "\x02id\x18\x01 \x01(\tR\x02id\"\xe9\x05\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\"\xb2\x06\n" +"\bTransfer\x12\x0e\n" +"\x02id\x18\x01 \x01(\tR\x02id\x12>\n" +"\tdirection\x18\x02 \x01(\x0e2 .pasteferry.v1.TransferDirectionR\tdirection\x12\x1b\n" +@@ -5217,7 +6319,15 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\fcurrent_file\x18\x13 \x01(\tR\vcurrentFile\x12#\n" +"\rcurrent_index\x18\x14 \x01(\x03R\fcurrentIndex\x12\x18\n" +"\apresent\x18\x15 \x03(\bR\apresent\x12#\n" +- "\rrenamed_files\x18\x16 \x01(\x03R\frenamedFiles\"\x8d\x01\n" ++ "\rrenamed_files\x18\x16 \x01(\x03R\frenamedFiles\x12\x1b\n" ++ "\tpeer_role\x18\x17 \x01(\tR\bpeerRole\x12\x12\n" ++ "\x04note\x18\x18 \x01(\tR\x04note\x12\x16\n" ++ "\x06thumbs\x18\x19 \x03(\tR\x06thumbs\"h\n" ++ "\x15AnswerIncomingRequest\x12\x1f\n" ++ "\vtransfer_id\x18\x01 \x01(\tR\n" ++ "transferId\x12\x16\n" ++ "\x06accept\x18\x02 \x01(\bR\x06accept\x12\x16\n" ++ "\x06always\x18\x03 \x01(\bR\x06always\"\x8d\x01\n" +"\x14ListTransfersRequest\x12>\n" +"\tdirection\x18\x01 \x01(\x0e2 .pasteferry.v1.TransferDirectionR\tdirection\x12\x14\n" +"\x05limit\x18\x02 \x01(\x05R\x05limit\x12\x1f\n" +@@ -5276,7 +6386,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x11TransferDirection\x12\"\n" +"\x1eTRANSFER_DIRECTION_UNSPECIFIED\x10\x00\x12\x1f\n" +"\x1bTRANSFER_DIRECTION_OUTGOING\x10\x01\x12\x1f\n" +- "\x1bTRANSFER_DIRECTION_INCOMING\x10\x022\xdd\x19\n" ++ "\x1bTRANSFER_DIRECTION_INCOMING\x10\x022\xe0!\n" +"\rDaemonService\x12D\n" +"\tSubscribe\x12\x1f.pasteferry.v1.SubscribeRequest\x1a\x14.pasteferry.v1.Event0\x01\x12T\n" +"\vListHistory\x12!.pasteferry.v1.ListHistoryRequest\x1a\".pasteferry.v1.ListHistoryResponse\x12J\n" +@@ -5321,7 +6431,22 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\rListTransfers\x12#.pasteferry.v1.ListTransfersRequest\x1a$.pasteferry.v1.ListTransfersResponse\x12N\n" +"\x0fDeleteTransfers\x12%.pasteferry.v1.DeleteTransfersRequest\x1a\x14.pasteferry.v1.Empty\x12?\n" +"\x11MarkTransfersSeen\x12\x14.pasteferry.v1.Empty\x1a\x14.pasteferry.v1.Empty\x12`\n" +- "\x0fCheckReceiveDir\x12%.pasteferry.v1.CheckReceiveDirRequest\x1a&.pasteferry.v1.CheckReceiveDirResponseBDZBgithub.com/baiyuze/pasteferry/proto/gen/pasteferry/v1;pasteferryv1b\x06proto3"+ "\x0fCheckReceiveDir\x12%.pasteferry.v1.CheckReceiveDirRequest\x1a&.pasteferry.v1.CheckReceiveDirResponse\x12L\n" ++ "\x0eAnswerIncoming\x12$.pasteferry.v1.AnswerIncomingRequest\x1a\x14.pasteferry.v1.Empty\x12:\n" ++ "\n" ++ "GetProfile\x12\x14.pasteferry.v1.Empty\x1a\x16.pasteferry.v1.Profile\x12N\n" ++ "\x0eSetDisplayName\x12$.pasteferry.v1.SetDisplayNameRequest\x1a\x16.pasteferry.v1.Profile\x12D\n" ++ "\tSetAvatar\x12\x1f.pasteferry.v1.SetAvatarRequest\x1a\x16.pasteferry.v1.Profile\x12;\n" ++ "\vResetAvatar\x12\x14.pasteferry.v1.Empty\x1a\x16.pasteferry.v1.Profile\x12C\n" ++ "\tGetAvatar\x12\x1f.pasteferry.v1.GetAvatarRequest\x1a\x15.pasteferry.v1.Avatar\x12R\n" ++ "\x10CreateFriendCode\x12\x14.pasteferry.v1.Empty\x1a(.pasteferry.v1.CreatePairingCodeResponse\x12Y\n" ++ "\x10RedeemFriendCode\x12'.pasteferry.v1.RedeemPairingCodeRequest\x1a\x1c.pasteferry.v1.FriendRequest\x12K\n" ++ "\rConfirmFriend\x12$.pasteferry.v1.ConfirmPairingRequest\x1a\x14.pasteferry.v1.Empty\x12G\n" ++ "\vListFriends\x12\x14.pasteferry.v1.Empty\x1a\".pasteferry.v1.ListFriendsResponse\x12>\n" ++ "\fRemoveFriend\x12\x18.pasteferry.v1.FriendRef\x1a\x14.pasteferry.v1.Empty\x12W\n" ++ "\x13SetFriendAutoAccept\x12).pasteferry.v1.SetFriendAutoAcceptRequest\x1a\x15.pasteferry.v1.Friend\x12=\n" ++ "\vBlockDevice\x12\x18.pasteferry.v1.FriendRef\x1a\x14.pasteferry.v1.Empty\x12B\n" ++ "\x0eWatchStrangers\x12\x14.pasteferry.v1.Empty\x1a\x18.pasteferry.v1.Strangers0\x01BDZBgithub.com/baiyuze/pasteferry/proto/gen/pasteferry/v1;pasteferryv1b\x06proto3"var (file_pasteferry_v1_daemon_proto_rawDescOnce sync.Once@@ -5336,75 +6461,88 @@ func file_pasteferry_v1_daemon_proto_rawDescGZIP() []byte {}var file_pasteferry_v1_daemon_proto_enumTypes = make([]protoimpl.EnumInfo, 7)-var file_pasteferry_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 60)+var file_pasteferry_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 73)var file_pasteferry_v1_daemon_proto_goTypes = []any{- (ClipKind)(0), // 0: pasteferry.v1.ClipKind- (ClipStatus)(0), // 1: pasteferry.v1.ClipStatus- (ConnectionKind)(0), // 2: pasteferry.v1.ConnectionKind- (ClipboardPermission)(0), // 3: pasteferry.v1.ClipboardPermission- (ClipboardWriteOutcome)(0), // 4: pasteferry.v1.ClipboardWriteOutcome- (ServiceMode)(0), // 5: pasteferry.v1.ServiceMode- (TransferDirection)(0), // 6: pasteferry.v1.TransferDirection- (*Empty)(nil), // 7: pasteferry.v1.Empty- (*ClipItem)(nil), // 8: pasteferry.v1.ClipItem- (*ClipRecord)(nil), // 9: pasteferry.v1.ClipRecord- (*SubscribeRequest)(nil), // 10: pasteferry.v1.SubscribeRequest- (*TransferProgress)(nil), // 11: pasteferry.v1.TransferProgress- (*Device)(nil), // 12: pasteferry.v1.Device- (*Event)(nil), // 13: pasteferry.v1.Event- (*NotificationStatus)(nil), // 14: pasteferry.v1.NotificationStatus- (*NotificationAction)(nil), // 15: pasteferry.v1.NotificationAction- (*ClipboardWriteResult)(nil), // 16: pasteferry.v1.ClipboardWriteResult- (*ListHistoryRequest)(nil), // 17: pasteferry.v1.ListHistoryRequest- (*ListHistoryResponse)(nil), // 18: pasteferry.v1.ListHistoryResponse- (*DeleteHistoryRequest)(nil), // 19: pasteferry.v1.DeleteHistoryRequest- (*FetchRequest)(nil), // 20: pasteferry.v1.FetchRequest- (*ApplyToClipboardRequest)(nil), // 21: pasteferry.v1.ApplyToClipboardRequest- (*SetFavoriteRequest)(nil), // 22: pasteferry.v1.SetFavoriteRequest- (*SetAliasRequest)(nil), // 23: pasteferry.v1.SetAliasRequest- (*GetClipDetailRequest)(nil), // 24: pasteferry.v1.GetClipDetailRequest- (*ClipDetail)(nil), // 25: pasteferry.v1.ClipDetail- (*QuickPasteStatus)(nil), // 26: pasteferry.v1.QuickPasteStatus- (*QuickPasteCommand)(nil), // 27: pasteferry.v1.QuickPasteCommand- (*ListDevicesResponse)(nil), // 28: pasteferry.v1.ListDevicesResponse- (*CreatePairingCodeResponse)(nil), // 29: pasteferry.v1.CreatePairingCodeResponse- (*RedeemPairingCodeRequest)(nil), // 30: pasteferry.v1.RedeemPairingCodeRequest- (*RedeemPairingCodeResponse)(nil), // 31: pasteferry.v1.RedeemPairingCodeResponse- (*ConfirmPairingRequest)(nil), // 32: pasteferry.v1.ConfirmPairingRequest- (*NearbyDevice)(nil), // 33: pasteferry.v1.NearbyDevice- (*NearbyDevices)(nil), // 34: pasteferry.v1.NearbyDevices- (*PairNearbyRequest)(nil), // 35: pasteferry.v1.PairNearbyRequest- (*UnpairRequest)(nil), // 36: pasteferry.v1.UnpairRequest- (*ReconnectRequest)(nil), // 37: pasteferry.v1.ReconnectRequest- (*ReconnectResponse)(nil), // 38: pasteferry.v1.ReconnectResponse- (*SetDeviceAddressRequest)(nil), // 39: pasteferry.v1.SetDeviceAddressRequest- (*Config)(nil), // 40: pasteferry.v1.Config- (*OfficialUsage)(nil), // 41: pasteferry.v1.OfficialUsage- (*NetworkInfo)(nil), // 42: pasteferry.v1.NetworkInfo- (*LanInfo)(nil), // 43: pasteferry.v1.LanInfo- (*LanPeer)(nil), // 44: pasteferry.v1.LanPeer- (*NetworkEgress)(nil), // 45: pasteferry.v1.NetworkEgress- (*Status)(nil), // 46: pasteferry.v1.Status- (*CheckForUpdateRequest)(nil), // 47: pasteferry.v1.CheckForUpdateRequest- (*UpdateRelease)(nil), // 48: pasteferry.v1.UpdateRelease- (*UpdateInfo)(nil), // 49: pasteferry.v1.UpdateInfo- (*DownloadUpdateRequest)(nil), // 50: pasteferry.v1.DownloadUpdateRequest- (*UpdateProgress)(nil), // 51: pasteferry.v1.UpdateProgress- (*InstallUpdateRequest)(nil), // 52: pasteferry.v1.InstallUpdateRequest- (*UpdateResult)(nil), // 53: pasteferry.v1.UpdateResult- (*ExportDiagnosticsRequest)(nil), // 54: pasteferry.v1.ExportDiagnosticsRequest- (*Diagnostics)(nil), // 55: pasteferry.v1.Diagnostics- (*SetVerboseLogRequest)(nil), // 56: pasteferry.v1.SetVerboseLogRequest- (*GetImagePreviewRequest)(nil), // 57: pasteferry.v1.GetImagePreviewRequest- (*GetImagePreviewResponse)(nil), // 58: pasteferry.v1.GetImagePreviewResponse- (*SendFilesRequest)(nil), // 59: pasteferry.v1.SendFilesRequest- (*TransferRef)(nil), // 60: pasteferry.v1.TransferRef- (*Transfer)(nil), // 61: pasteferry.v1.Transfer- (*ListTransfersRequest)(nil), // 62: pasteferry.v1.ListTransfersRequest- (*ListTransfersResponse)(nil), // 63: pasteferry.v1.ListTransfersResponse- (*DeleteTransfersRequest)(nil), // 64: pasteferry.v1.DeleteTransfersRequest- (*CheckReceiveDirRequest)(nil), // 65: pasteferry.v1.CheckReceiveDirRequest- (*CheckReceiveDirResponse)(nil), // 66: pasteferry.v1.CheckReceiveDirResponse+ (ClipKind)(0), // 0: pasteferry.v1.ClipKind+ (ClipStatus)(0), // 1: pasteferry.v1.ClipStatus+ (ConnectionKind)(0), // 2: pasteferry.v1.ConnectionKind+ (ClipboardPermission)(0), // 3: pasteferry.v1.ClipboardPermission+ (ClipboardWriteOutcome)(0), // 4: pasteferry.v1.ClipboardWriteOutcome+ (ServiceMode)(0), // 5: pasteferry.v1.ServiceMode+ (TransferDirection)(0), // 6: pasteferry.v1.TransferDirection+ (*Empty)(nil), // 7: pasteferry.v1.Empty+ (*ClipItem)(nil), // 8: pasteferry.v1.ClipItem+ (*ClipRecord)(nil), // 9: pasteferry.v1.ClipRecord+ (*SubscribeRequest)(nil), // 10: pasteferry.v1.SubscribeRequest+ (*TransferProgress)(nil), // 11: pasteferry.v1.TransferProgress+ (*Device)(nil), // 12: pasteferry.v1.Device+ (*Event)(nil), // 13: pasteferry.v1.Event+ (*Profile)(nil), // 14: pasteferry.v1.Profile+ (*SetDisplayNameRequest)(nil), // 15: pasteferry.v1.SetDisplayNameRequest+ (*SetAvatarRequest)(nil), // 16: pasteferry.v1.SetAvatarRequest+ (*GetAvatarRequest)(nil), // 17: pasteferry.v1.GetAvatarRequest+ (*Avatar)(nil), // 18: pasteferry.v1.Avatar+ (*FriendRef)(nil), // 19: pasteferry.v1.FriendRef+ (*SetFriendAutoAcceptRequest)(nil), // 20: pasteferry.v1.SetFriendAutoAcceptRequest+ (*Friend)(nil), // 21: pasteferry.v1.Friend+ (*ListFriendsResponse)(nil), // 22: pasteferry.v1.ListFriendsResponse+ (*FriendRequest)(nil), // 23: pasteferry.v1.FriendRequest+ (*Stranger)(nil), // 24: pasteferry.v1.Stranger+ (*Strangers)(nil), // 25: pasteferry.v1.Strangers+ (*NotificationStatus)(nil), // 26: pasteferry.v1.NotificationStatus+ (*NotificationAction)(nil), // 27: pasteferry.v1.NotificationAction+ (*ClipboardWriteResult)(nil), // 28: pasteferry.v1.ClipboardWriteResult+ (*ListHistoryRequest)(nil), // 29: pasteferry.v1.ListHistoryRequest+ (*ListHistoryResponse)(nil), // 30: pasteferry.v1.ListHistoryResponse+ (*DeleteHistoryRequest)(nil), // 31: pasteferry.v1.DeleteHistoryRequest+ (*FetchRequest)(nil), // 32: pasteferry.v1.FetchRequest+ (*ApplyToClipboardRequest)(nil), // 33: pasteferry.v1.ApplyToClipboardRequest+ (*SetFavoriteRequest)(nil), // 34: pasteferry.v1.SetFavoriteRequest+ (*SetAliasRequest)(nil), // 35: pasteferry.v1.SetAliasRequest+ (*GetClipDetailRequest)(nil), // 36: pasteferry.v1.GetClipDetailRequest+ (*ClipDetail)(nil), // 37: pasteferry.v1.ClipDetail+ (*QuickPasteStatus)(nil), // 38: pasteferry.v1.QuickPasteStatus+ (*QuickPasteCommand)(nil), // 39: pasteferry.v1.QuickPasteCommand+ (*ListDevicesResponse)(nil), // 40: pasteferry.v1.ListDevicesResponse+ (*CreatePairingCodeResponse)(nil), // 41: pasteferry.v1.CreatePairingCodeResponse+ (*RedeemPairingCodeRequest)(nil), // 42: pasteferry.v1.RedeemPairingCodeRequest+ (*RedeemPairingCodeResponse)(nil), // 43: pasteferry.v1.RedeemPairingCodeResponse+ (*ConfirmPairingRequest)(nil), // 44: pasteferry.v1.ConfirmPairingRequest+ (*NearbyDevice)(nil), // 45: pasteferry.v1.NearbyDevice+ (*NearbyDevices)(nil), // 46: pasteferry.v1.NearbyDevices+ (*PairNearbyRequest)(nil), // 47: pasteferry.v1.PairNearbyRequest+ (*UnpairRequest)(nil), // 48: pasteferry.v1.UnpairRequest+ (*ReconnectRequest)(nil), // 49: pasteferry.v1.ReconnectRequest+ (*ReconnectResponse)(nil), // 50: pasteferry.v1.ReconnectResponse+ (*SetDeviceAddressRequest)(nil), // 51: pasteferry.v1.SetDeviceAddressRequest+ (*Config)(nil), // 52: pasteferry.v1.Config+ (*OfficialUsage)(nil), // 53: pasteferry.v1.OfficialUsage+ (*NetworkInfo)(nil), // 54: pasteferry.v1.NetworkInfo+ (*LanInfo)(nil), // 55: pasteferry.v1.LanInfo+ (*LanPeer)(nil), // 56: pasteferry.v1.LanPeer+ (*NetworkEgress)(nil), // 57: pasteferry.v1.NetworkEgress+ (*Status)(nil), // 58: pasteferry.v1.Status+ (*CheckForUpdateRequest)(nil), // 59: pasteferry.v1.CheckForUpdateRequest+ (*UpdateRelease)(nil), // 60: pasteferry.v1.UpdateRelease+ (*UpdateInfo)(nil), // 61: pasteferry.v1.UpdateInfo+ (*DownloadUpdateRequest)(nil), // 62: pasteferry.v1.DownloadUpdateRequest+ (*UpdateProgress)(nil), // 63: pasteferry.v1.UpdateProgress+ (*InstallUpdateRequest)(nil), // 64: pasteferry.v1.InstallUpdateRequest+ (*UpdateResult)(nil), // 65: pasteferry.v1.UpdateResult+ (*ExportDiagnosticsRequest)(nil), // 66: pasteferry.v1.ExportDiagnosticsRequest+ (*Diagnostics)(nil), // 67: pasteferry.v1.Diagnostics+ (*SetVerboseLogRequest)(nil), // 68: pasteferry.v1.SetVerboseLogRequest+ (*GetImagePreviewRequest)(nil), // 69: pasteferry.v1.GetImagePreviewRequest+ (*GetImagePreviewResponse)(nil), // 70: pasteferry.v1.GetImagePreviewResponse+ (*SendFilesRequest)(nil), // 71: pasteferry.v1.SendFilesRequest+ (*TransferRef)(nil), // 72: pasteferry.v1.TransferRef+ (*Transfer)(nil), // 73: pasteferry.v1.Transfer+ (*AnswerIncomingRequest)(nil), // 74: pasteferry.v1.AnswerIncomingRequest+ (*ListTransfersRequest)(nil), // 75: pasteferry.v1.ListTransfersRequest+ (*ListTransfersResponse)(nil), // 76: pasteferry.v1.ListTransfersResponse+ (*DeleteTransfersRequest)(nil), // 77: pasteferry.v1.DeleteTransfersRequest+ (*CheckReceiveDirRequest)(nil), // 78: pasteferry.v1.CheckReceiveDirRequest+ (*CheckReceiveDirResponse)(nil), // 79: pasteferry.v1.CheckReceiveDirResponse}var file_pasteferry_v1_daemon_proto_depIdxs = []int32{0, // 0: pasteferry.v1.ClipRecord.kind:type_name -> pasteferry.v1.ClipKind@@ -5416,121 +6554,155 @@ var file_pasteferry_v1_daemon_proto_depIdxs = []int32{11, // 6: pasteferry.v1.Event.progress:type_name -> pasteferry.v1.TransferProgress12, // 7: pasteferry.v1.Event.device_changed:type_name -> pasteferry.v1.Device3, // 8: pasteferry.v1.Event.permission_changed:type_name -> pasteferry.v1.ClipboardPermission- 46, // 9: pasteferry.v1.Event.status_changed:type_name -> pasteferry.v1.Status- 16, // 10: pasteferry.v1.Event.clipboard_written:type_name -> pasteferry.v1.ClipboardWriteResult- 40, // 11: pasteferry.v1.Event.config_changed:type_name -> pasteferry.v1.Config- 26, // 12: pasteferry.v1.Event.quick_paste_changed:type_name -> pasteferry.v1.QuickPasteStatus- 61, // 13: pasteferry.v1.Event.transfer_changed:type_name -> pasteferry.v1.Transfer- 4, // 14: pasteferry.v1.ClipboardWriteResult.outcome:type_name -> pasteferry.v1.ClipboardWriteOutcome- 0, // 15: pasteferry.v1.ListHistoryRequest.kind_filter:type_name -> pasteferry.v1.ClipKind- 9, // 16: pasteferry.v1.ListHistoryResponse.records:type_name -> pasteferry.v1.ClipRecord- 12, // 17: pasteferry.v1.ListDevicesResponse.self:type_name -> pasteferry.v1.Device- 12, // 18: pasteferry.v1.ListDevicesResponse.peers:type_name -> pasteferry.v1.Device- 12, // 19: pasteferry.v1.RedeemPairingCodeResponse.peer:type_name -> pasteferry.v1.Device- 33, // 20: pasteferry.v1.NearbyDevices.devices:type_name -> pasteferry.v1.NearbyDevice- 2, // 21: pasteferry.v1.ReconnectResponse.kind:type_name -> pasteferry.v1.ConnectionKind- 5, // 22: pasteferry.v1.Config.service_mode:type_name -> pasteferry.v1.ServiceMode- 45, // 23: pasteferry.v1.NetworkInfo.egresses:type_name -> pasteferry.v1.NetworkEgress- 43, // 24: pasteferry.v1.NetworkInfo.lan:type_name -> pasteferry.v1.LanInfo- 44, // 25: pasteferry.v1.LanInfo.peers:type_name -> pasteferry.v1.LanPeer- 3, // 26: pasteferry.v1.Status.clipboard_permission:type_name -> pasteferry.v1.ClipboardPermission- 41, // 27: pasteferry.v1.Status.official_usage:type_name -> pasteferry.v1.OfficialUsage- 53, // 28: pasteferry.v1.Status.last_update:type_name -> pasteferry.v1.UpdateResult- 48, // 29: pasteferry.v1.UpdateInfo.releases:type_name -> pasteferry.v1.UpdateRelease- 6, // 30: pasteferry.v1.Transfer.direction:type_name -> pasteferry.v1.TransferDirection- 8, // 31: pasteferry.v1.Transfer.items:type_name -> pasteferry.v1.ClipItem- 6, // 32: pasteferry.v1.ListTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection- 61, // 33: pasteferry.v1.ListTransfersResponse.transfers:type_name -> pasteferry.v1.Transfer- 6, // 34: pasteferry.v1.DeleteTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection- 10, // 35: pasteferry.v1.DaemonService.Subscribe:input_type -> pasteferry.v1.SubscribeRequest- 17, // 36: pasteferry.v1.DaemonService.ListHistory:input_type -> pasteferry.v1.ListHistoryRequest- 19, // 37: pasteferry.v1.DaemonService.DeleteHistory:input_type -> pasteferry.v1.DeleteHistoryRequest- 20, // 38: pasteferry.v1.DaemonService.Fetch:input_type -> pasteferry.v1.FetchRequest- 21, // 39: pasteferry.v1.DaemonService.ApplyToClipboard:input_type -> pasteferry.v1.ApplyToClipboardRequest- 57, // 40: pasteferry.v1.DaemonService.GetImagePreview:input_type -> pasteferry.v1.GetImagePreviewRequest- 7, // 41: pasteferry.v1.DaemonService.ListDevices:input_type -> pasteferry.v1.Empty- 7, // 42: pasteferry.v1.DaemonService.CreatePairingCode:input_type -> pasteferry.v1.Empty- 30, // 43: pasteferry.v1.DaemonService.RedeemPairingCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest- 32, // 44: pasteferry.v1.DaemonService.ConfirmPairing:input_type -> pasteferry.v1.ConfirmPairingRequest- 36, // 45: pasteferry.v1.DaemonService.Unpair:input_type -> pasteferry.v1.UnpairRequest- 37, // 46: pasteferry.v1.DaemonService.Reconnect:input_type -> pasteferry.v1.ReconnectRequest- 39, // 47: pasteferry.v1.DaemonService.SetDeviceAddress:input_type -> pasteferry.v1.SetDeviceAddressRequest- 7, // 48: pasteferry.v1.DaemonService.WatchNearby:input_type -> pasteferry.v1.Empty- 35, // 49: pasteferry.v1.DaemonService.PairNearby:input_type -> pasteferry.v1.PairNearbyRequest- 7, // 50: pasteferry.v1.DaemonService.GetConfig:input_type -> pasteferry.v1.Empty- 40, // 51: pasteferry.v1.DaemonService.UpdateConfig:input_type -> pasteferry.v1.Config- 7, // 52: pasteferry.v1.DaemonService.GetStatus:input_type -> pasteferry.v1.Empty- 7, // 53: pasteferry.v1.DaemonService.RequestClipboardPermission:input_type -> pasteferry.v1.Empty- 7, // 54: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:input_type -> pasteferry.v1.Empty- 7, // 55: pasteferry.v1.DaemonService.GetNotificationStatus:input_type -> pasteferry.v1.Empty- 7, // 56: pasteferry.v1.DaemonService.RequestNotificationPermission:input_type -> pasteferry.v1.Empty- 15, // 57: pasteferry.v1.DaemonService.ActivateNotification:input_type -> pasteferry.v1.NotificationAction- 7, // 58: pasteferry.v1.DaemonService.GetNetwork:input_type -> pasteferry.v1.Empty- 54, // 59: pasteferry.v1.DaemonService.ExportDiagnostics:input_type -> pasteferry.v1.ExportDiagnosticsRequest- 56, // 60: pasteferry.v1.DaemonService.SetVerboseLog:input_type -> pasteferry.v1.SetVerboseLogRequest- 47, // 61: pasteferry.v1.DaemonService.CheckForUpdate:input_type -> pasteferry.v1.CheckForUpdateRequest- 50, // 62: pasteferry.v1.DaemonService.DownloadUpdate:input_type -> pasteferry.v1.DownloadUpdateRequest- 52, // 63: pasteferry.v1.DaemonService.InstallUpdate:input_type -> pasteferry.v1.InstallUpdateRequest- 22, // 64: pasteferry.v1.DaemonService.SetFavorite:input_type -> pasteferry.v1.SetFavoriteRequest- 24, // 65: pasteferry.v1.DaemonService.GetClipDetail:input_type -> pasteferry.v1.GetClipDetailRequest- 23, // 66: pasteferry.v1.DaemonService.SetAlias:input_type -> pasteferry.v1.SetAliasRequest- 26, // 67: pasteferry.v1.DaemonService.QuickPasteSession:input_type -> pasteferry.v1.QuickPasteStatus- 7, // 68: pasteferry.v1.DaemonService.GetQuickPasteStatus:input_type -> pasteferry.v1.Empty- 27, // 69: pasteferry.v1.DaemonService.SendQuickPasteCommand:input_type -> pasteferry.v1.QuickPasteCommand- 59, // 70: pasteferry.v1.DaemonService.SendFiles:input_type -> pasteferry.v1.SendFilesRequest- 60, // 71: pasteferry.v1.DaemonService.CancelTransfer:input_type -> pasteferry.v1.TransferRef- 60, // 72: pasteferry.v1.DaemonService.ResumeTransfer:input_type -> pasteferry.v1.TransferRef- 62, // 73: pasteferry.v1.DaemonService.ListTransfers:input_type -> pasteferry.v1.ListTransfersRequest- 64, // 74: pasteferry.v1.DaemonService.DeleteTransfers:input_type -> pasteferry.v1.DeleteTransfersRequest- 7, // 75: pasteferry.v1.DaemonService.MarkTransfersSeen:input_type -> pasteferry.v1.Empty- 65, // 76: pasteferry.v1.DaemonService.CheckReceiveDir:input_type -> pasteferry.v1.CheckReceiveDirRequest- 13, // 77: pasteferry.v1.DaemonService.Subscribe:output_type -> pasteferry.v1.Event- 18, // 78: pasteferry.v1.DaemonService.ListHistory:output_type -> pasteferry.v1.ListHistoryResponse- 7, // 79: pasteferry.v1.DaemonService.DeleteHistory:output_type -> pasteferry.v1.Empty- 7, // 80: pasteferry.v1.DaemonService.Fetch:output_type -> pasteferry.v1.Empty- 7, // 81: pasteferry.v1.DaemonService.ApplyToClipboard:output_type -> pasteferry.v1.Empty- 58, // 82: pasteferry.v1.DaemonService.GetImagePreview:output_type -> pasteferry.v1.GetImagePreviewResponse- 28, // 83: pasteferry.v1.DaemonService.ListDevices:output_type -> pasteferry.v1.ListDevicesResponse- 29, // 84: pasteferry.v1.DaemonService.CreatePairingCode:output_type -> pasteferry.v1.CreatePairingCodeResponse- 31, // 85: pasteferry.v1.DaemonService.RedeemPairingCode:output_type -> pasteferry.v1.RedeemPairingCodeResponse- 7, // 86: pasteferry.v1.DaemonService.ConfirmPairing:output_type -> pasteferry.v1.Empty- 7, // 87: pasteferry.v1.DaemonService.Unpair:output_type -> pasteferry.v1.Empty- 38, // 88: pasteferry.v1.DaemonService.Reconnect:output_type -> pasteferry.v1.ReconnectResponse- 7, // 89: pasteferry.v1.DaemonService.SetDeviceAddress:output_type -> pasteferry.v1.Empty- 34, // 90: pasteferry.v1.DaemonService.WatchNearby:output_type -> pasteferry.v1.NearbyDevices- 31, // 91: pasteferry.v1.DaemonService.PairNearby:output_type -> pasteferry.v1.RedeemPairingCodeResponse- 40, // 92: pasteferry.v1.DaemonService.GetConfig:output_type -> pasteferry.v1.Config- 40, // 93: pasteferry.v1.DaemonService.UpdateConfig:output_type -> pasteferry.v1.Config- 46, // 94: pasteferry.v1.DaemonService.GetStatus:output_type -> pasteferry.v1.Status- 7, // 95: pasteferry.v1.DaemonService.RequestClipboardPermission:output_type -> pasteferry.v1.Empty- 7, // 96: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:output_type -> pasteferry.v1.Empty- 14, // 97: pasteferry.v1.DaemonService.GetNotificationStatus:output_type -> pasteferry.v1.NotificationStatus- 14, // 98: pasteferry.v1.DaemonService.RequestNotificationPermission:output_type -> pasteferry.v1.NotificationStatus- 7, // 99: pasteferry.v1.DaemonService.ActivateNotification:output_type -> pasteferry.v1.Empty- 42, // 100: pasteferry.v1.DaemonService.GetNetwork:output_type -> pasteferry.v1.NetworkInfo- 55, // 101: pasteferry.v1.DaemonService.ExportDiagnostics:output_type -> pasteferry.v1.Diagnostics- 46, // 102: pasteferry.v1.DaemonService.SetVerboseLog:output_type -> pasteferry.v1.Status- 49, // 103: pasteferry.v1.DaemonService.CheckForUpdate:output_type -> pasteferry.v1.UpdateInfo- 51, // 104: pasteferry.v1.DaemonService.DownloadUpdate:output_type -> pasteferry.v1.UpdateProgress- 7, // 105: pasteferry.v1.DaemonService.InstallUpdate:output_type -> pasteferry.v1.Empty- 9, // 106: pasteferry.v1.DaemonService.SetFavorite:output_type -> pasteferry.v1.ClipRecord- 25, // 107: pasteferry.v1.DaemonService.GetClipDetail:output_type -> pasteferry.v1.ClipDetail- 9, // 108: pasteferry.v1.DaemonService.SetAlias:output_type -> pasteferry.v1.ClipRecord- 27, // 109: pasteferry.v1.DaemonService.QuickPasteSession:output_type -> pasteferry.v1.QuickPasteCommand- 26, // 110: pasteferry.v1.DaemonService.GetQuickPasteStatus:output_type -> pasteferry.v1.QuickPasteStatus- 7, // 111: pasteferry.v1.DaemonService.SendQuickPasteCommand:output_type -> pasteferry.v1.Empty- 61, // 112: pasteferry.v1.DaemonService.SendFiles:output_type -> pasteferry.v1.Transfer- 7, // 113: pasteferry.v1.DaemonService.CancelTransfer:output_type -> pasteferry.v1.Empty- 7, // 114: pasteferry.v1.DaemonService.ResumeTransfer:output_type -> pasteferry.v1.Empty- 63, // 115: pasteferry.v1.DaemonService.ListTransfers:output_type -> pasteferry.v1.ListTransfersResponse- 7, // 116: pasteferry.v1.DaemonService.DeleteTransfers:output_type -> pasteferry.v1.Empty- 7, // 117: pasteferry.v1.DaemonService.MarkTransfersSeen:output_type -> pasteferry.v1.Empty- 66, // 118: pasteferry.v1.DaemonService.CheckReceiveDir:output_type -> pasteferry.v1.CheckReceiveDirResponse- 77, // [77:119] is the sub-list for method output_type- 35, // [35:77] is the sub-list for method input_type- 35, // [35:35] is the sub-list for extension type_name- 35, // [35:35] is the sub-list for extension extendee- 0, // [0:35] is the sub-list for field type_name+ 58, // 9: pasteferry.v1.Event.status_changed:type_name -> pasteferry.v1.Status+ 28, // 10: pasteferry.v1.Event.clipboard_written:type_name -> pasteferry.v1.ClipboardWriteResult+ 52, // 11: pasteferry.v1.Event.config_changed:type_name -> pasteferry.v1.Config+ 38, // 12: pasteferry.v1.Event.quick_paste_changed:type_name -> pasteferry.v1.QuickPasteStatus+ 73, // 13: pasteferry.v1.Event.transfer_changed:type_name -> pasteferry.v1.Transfer+ 21, // 14: pasteferry.v1.Event.friend_changed:type_name -> pasteferry.v1.Friend+ 23, // 15: pasteferry.v1.Event.friend_request:type_name -> pasteferry.v1.FriendRequest+ 14, // 16: pasteferry.v1.Event.profile_changed:type_name -> pasteferry.v1.Profile+ 2, // 17: pasteferry.v1.Friend.connection:type_name -> pasteferry.v1.ConnectionKind+ 21, // 18: pasteferry.v1.ListFriendsResponse.friends:type_name -> pasteferry.v1.Friend+ 24, // 19: pasteferry.v1.Strangers.strangers:type_name -> pasteferry.v1.Stranger+ 4, // 20: pasteferry.v1.ClipboardWriteResult.outcome:type_name -> pasteferry.v1.ClipboardWriteOutcome+ 0, // 21: pasteferry.v1.ListHistoryRequest.kind_filter:type_name -> pasteferry.v1.ClipKind+ 9, // 22: pasteferry.v1.ListHistoryResponse.records:type_name -> pasteferry.v1.ClipRecord+ 12, // 23: pasteferry.v1.ListDevicesResponse.self:type_name -> pasteferry.v1.Device+ 12, // 24: pasteferry.v1.ListDevicesResponse.peers:type_name -> pasteferry.v1.Device+ 12, // 25: pasteferry.v1.RedeemPairingCodeResponse.peer:type_name -> pasteferry.v1.Device+ 45, // 26: pasteferry.v1.NearbyDevices.devices:type_name -> pasteferry.v1.NearbyDevice+ 2, // 27: pasteferry.v1.ReconnectResponse.kind:type_name -> pasteferry.v1.ConnectionKind+ 5, // 28: pasteferry.v1.Config.service_mode:type_name -> pasteferry.v1.ServiceMode+ 57, // 29: pasteferry.v1.NetworkInfo.egresses:type_name -> pasteferry.v1.NetworkEgress+ 55, // 30: pasteferry.v1.NetworkInfo.lan:type_name -> pasteferry.v1.LanInfo+ 56, // 31: pasteferry.v1.LanInfo.peers:type_name -> pasteferry.v1.LanPeer+ 3, // 32: pasteferry.v1.Status.clipboard_permission:type_name -> pasteferry.v1.ClipboardPermission+ 53, // 33: pasteferry.v1.Status.official_usage:type_name -> pasteferry.v1.OfficialUsage+ 65, // 34: pasteferry.v1.Status.last_update:type_name -> pasteferry.v1.UpdateResult+ 60, // 35: pasteferry.v1.UpdateInfo.releases:type_name -> pasteferry.v1.UpdateRelease+ 6, // 36: pasteferry.v1.Transfer.direction:type_name -> pasteferry.v1.TransferDirection+ 8, // 37: pasteferry.v1.Transfer.items:type_name -> pasteferry.v1.ClipItem+ 6, // 38: pasteferry.v1.ListTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection+ 73, // 39: pasteferry.v1.ListTransfersResponse.transfers:type_name -> pasteferry.v1.Transfer+ 6, // 40: pasteferry.v1.DeleteTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection+ 10, // 41: pasteferry.v1.DaemonService.Subscribe:input_type -> pasteferry.v1.SubscribeRequest+ 29, // 42: pasteferry.v1.DaemonService.ListHistory:input_type -> pasteferry.v1.ListHistoryRequest+ 31, // 43: pasteferry.v1.DaemonService.DeleteHistory:input_type -> pasteferry.v1.DeleteHistoryRequest+ 32, // 44: pasteferry.v1.DaemonService.Fetch:input_type -> pasteferry.v1.FetchRequest+ 33, // 45: pasteferry.v1.DaemonService.ApplyToClipboard:input_type -> pasteferry.v1.ApplyToClipboardRequest+ 69, // 46: pasteferry.v1.DaemonService.GetImagePreview:input_type -> pasteferry.v1.GetImagePreviewRequest+ 7, // 47: pasteferry.v1.DaemonService.ListDevices:input_type -> pasteferry.v1.Empty+ 7, // 48: pasteferry.v1.DaemonService.CreatePairingCode:input_type -> pasteferry.v1.Empty+ 42, // 49: pasteferry.v1.DaemonService.RedeemPairingCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest+ 44, // 50: pasteferry.v1.DaemonService.ConfirmPairing:input_type -> pasteferry.v1.ConfirmPairingRequest+ 48, // 51: pasteferry.v1.DaemonService.Unpair:input_type -> pasteferry.v1.UnpairRequest+ 49, // 52: pasteferry.v1.DaemonService.Reconnect:input_type -> pasteferry.v1.ReconnectRequest+ 51, // 53: pasteferry.v1.DaemonService.SetDeviceAddress:input_type -> pasteferry.v1.SetDeviceAddressRequest+ 7, // 54: pasteferry.v1.DaemonService.WatchNearby:input_type -> pasteferry.v1.Empty+ 47, // 55: pasteferry.v1.DaemonService.PairNearby:input_type -> pasteferry.v1.PairNearbyRequest+ 7, // 56: pasteferry.v1.DaemonService.GetConfig:input_type -> pasteferry.v1.Empty+ 52, // 57: pasteferry.v1.DaemonService.UpdateConfig:input_type -> pasteferry.v1.Config+ 7, // 58: pasteferry.v1.DaemonService.GetStatus:input_type -> pasteferry.v1.Empty+ 7, // 59: pasteferry.v1.DaemonService.RequestClipboardPermission:input_type -> pasteferry.v1.Empty+ 7, // 60: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:input_type -> pasteferry.v1.Empty+ 7, // 61: pasteferry.v1.DaemonService.GetNotificationStatus:input_type -> pasteferry.v1.Empty+ 7, // 62: pasteferry.v1.DaemonService.RequestNotificationPermission:input_type -> pasteferry.v1.Empty+ 27, // 63: pasteferry.v1.DaemonService.ActivateNotification:input_type -> pasteferry.v1.NotificationAction+ 7, // 64: pasteferry.v1.DaemonService.GetNetwork:input_type -> pasteferry.v1.Empty+ 66, // 65: pasteferry.v1.DaemonService.ExportDiagnostics:input_type -> pasteferry.v1.ExportDiagnosticsRequest+ 68, // 66: pasteferry.v1.DaemonService.SetVerboseLog:input_type -> pasteferry.v1.SetVerboseLogRequest+ 59, // 67: pasteferry.v1.DaemonService.CheckForUpdate:input_type -> pasteferry.v1.CheckForUpdateRequest+ 62, // 68: pasteferry.v1.DaemonService.DownloadUpdate:input_type -> pasteferry.v1.DownloadUpdateRequest+ 64, // 69: pasteferry.v1.DaemonService.InstallUpdate:input_type -> pasteferry.v1.InstallUpdateRequest+ 34, // 70: pasteferry.v1.DaemonService.SetFavorite:input_type -> pasteferry.v1.SetFavoriteRequest+ 36, // 71: pasteferry.v1.DaemonService.GetClipDetail:input_type -> pasteferry.v1.GetClipDetailRequest+ 35, // 72: pasteferry.v1.DaemonService.SetAlias:input_type -> pasteferry.v1.SetAliasRequest+ 38, // 73: pasteferry.v1.DaemonService.QuickPasteSession:input_type -> pasteferry.v1.QuickPasteStatus+ 7, // 74: pasteferry.v1.DaemonService.GetQuickPasteStatus:input_type -> pasteferry.v1.Empty+ 39, // 75: pasteferry.v1.DaemonService.SendQuickPasteCommand:input_type -> pasteferry.v1.QuickPasteCommand+ 71, // 76: pasteferry.v1.DaemonService.SendFiles:input_type -> pasteferry.v1.SendFilesRequest+ 72, // 77: pasteferry.v1.DaemonService.CancelTransfer:input_type -> pasteferry.v1.TransferRef+ 72, // 78: pasteferry.v1.DaemonService.ResumeTransfer:input_type -> pasteferry.v1.TransferRef+ 75, // 79: pasteferry.v1.DaemonService.ListTransfers:input_type -> pasteferry.v1.ListTransfersRequest+ 77, // 80: pasteferry.v1.DaemonService.DeleteTransfers:input_type -> pasteferry.v1.DeleteTransfersRequest+ 7, // 81: pasteferry.v1.DaemonService.MarkTransfersSeen:input_type -> pasteferry.v1.Empty+ 78, // 82: pasteferry.v1.DaemonService.CheckReceiveDir:input_type -> pasteferry.v1.CheckReceiveDirRequest+ 74, // 83: pasteferry.v1.DaemonService.AnswerIncoming:input_type -> pasteferry.v1.AnswerIncomingRequest+ 7, // 84: pasteferry.v1.DaemonService.GetProfile:input_type -> pasteferry.v1.Empty+ 15, // 85: pasteferry.v1.DaemonService.SetDisplayName:input_type -> pasteferry.v1.SetDisplayNameRequest+ 16, // 86: pasteferry.v1.DaemonService.SetAvatar:input_type -> pasteferry.v1.SetAvatarRequest+ 7, // 87: pasteferry.v1.DaemonService.ResetAvatar:input_type -> pasteferry.v1.Empty+ 17, // 88: pasteferry.v1.DaemonService.GetAvatar:input_type -> pasteferry.v1.GetAvatarRequest+ 7, // 89: pasteferry.v1.DaemonService.CreateFriendCode:input_type -> pasteferry.v1.Empty+ 42, // 90: pasteferry.v1.DaemonService.RedeemFriendCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest+ 44, // 91: pasteferry.v1.DaemonService.ConfirmFriend:input_type -> pasteferry.v1.ConfirmPairingRequest+ 7, // 92: pasteferry.v1.DaemonService.ListFriends:input_type -> pasteferry.v1.Empty+ 19, // 93: pasteferry.v1.DaemonService.RemoveFriend:input_type -> pasteferry.v1.FriendRef+ 20, // 94: pasteferry.v1.DaemonService.SetFriendAutoAccept:input_type -> pasteferry.v1.SetFriendAutoAcceptRequest+ 19, // 95: pasteferry.v1.DaemonService.BlockDevice:input_type -> pasteferry.v1.FriendRef+ 7, // 96: pasteferry.v1.DaemonService.WatchStrangers:input_type -> pasteferry.v1.Empty+ 13, // 97: pasteferry.v1.DaemonService.Subscribe:output_type -> pasteferry.v1.Event+ 30, // 98: pasteferry.v1.DaemonService.ListHistory:output_type -> pasteferry.v1.ListHistoryResponse+ 7, // 99: pasteferry.v1.DaemonService.DeleteHistory:output_type -> pasteferry.v1.Empty+ 7, // 100: pasteferry.v1.DaemonService.Fetch:output_type -> pasteferry.v1.Empty+ 7, // 101: pasteferry.v1.DaemonService.ApplyToClipboard:output_type -> pasteferry.v1.Empty+ 70, // 102: pasteferry.v1.DaemonService.GetImagePreview:output_type -> pasteferry.v1.GetImagePreviewResponse+ 40, // 103: pasteferry.v1.DaemonService.ListDevices:output_type -> pasteferry.v1.ListDevicesResponse+ 41, // 104: pasteferry.v1.DaemonService.CreatePairingCode:output_type -> pasteferry.v1.CreatePairingCodeResponse+ 43, // 105: pasteferry.v1.DaemonService.RedeemPairingCode:output_type -> pasteferry.v1.RedeemPairingCodeResponse+ 7, // 106: pasteferry.v1.DaemonService.ConfirmPairing:output_type -> pasteferry.v1.Empty+ 7, // 107: pasteferry.v1.DaemonService.Unpair:output_type -> pasteferry.v1.Empty+ 50, // 108: pasteferry.v1.DaemonService.Reconnect:output_type -> pasteferry.v1.ReconnectResponse+ 7, // 109: pasteferry.v1.DaemonService.SetDeviceAddress:output_type -> pasteferry.v1.Empty+ 46, // 110: pasteferry.v1.DaemonService.WatchNearby:output_type -> pasteferry.v1.NearbyDevices+ 43, // 111: pasteferry.v1.DaemonService.PairNearby:output_type -> pasteferry.v1.RedeemPairingCodeResponse+ 52, // 112: pasteferry.v1.DaemonService.GetConfig:output_type -> pasteferry.v1.Config+ 52, // 113: pasteferry.v1.DaemonService.UpdateConfig:output_type -> pasteferry.v1.Config+ 58, // 114: pasteferry.v1.DaemonService.GetStatus:output_type -> pasteferry.v1.Status+ 7, // 115: pasteferry.v1.DaemonService.RequestClipboardPermission:output_type -> pasteferry.v1.Empty+ 7, // 116: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:output_type -> pasteferry.v1.Empty+ 26, // 117: pasteferry.v1.DaemonService.GetNotificationStatus:output_type -> pasteferry.v1.NotificationStatus+ 26, // 118: pasteferry.v1.DaemonService.RequestNotificationPermission:output_type -> pasteferry.v1.NotificationStatus+ 7, // 119: pasteferry.v1.DaemonService.ActivateNotification:output_type -> pasteferry.v1.Empty+ 54, // 120: pasteferry.v1.DaemonService.GetNetwork:output_type -> pasteferry.v1.NetworkInfo+ 67, // 121: pasteferry.v1.DaemonService.ExportDiagnostics:output_type -> pasteferry.v1.Diagnostics+ 58, // 122: pasteferry.v1.DaemonService.SetVerboseLog:output_type -> pasteferry.v1.Status+ 61, // 123: pasteferry.v1.DaemonService.CheckForUpdate:output_type -> pasteferry.v1.UpdateInfo+ 63, // 124: pasteferry.v1.DaemonService.DownloadUpdate:output_type -> pasteferry.v1.UpdateProgress+ 7, // 125: pasteferry.v1.DaemonService.InstallUpdate:output_type -> pasteferry.v1.Empty+ 9, // 126: pasteferry.v1.DaemonService.SetFavorite:output_type -> pasteferry.v1.ClipRecord+ 37, // 127: pasteferry.v1.DaemonService.GetClipDetail:output_type -> pasteferry.v1.ClipDetail+ 9, // 128: pasteferry.v1.DaemonService.SetAlias:output_type -> pasteferry.v1.ClipRecord+ 39, // 129: pasteferry.v1.DaemonService.QuickPasteSession:output_type -> pasteferry.v1.QuickPasteCommand+ 38, // 130: pasteferry.v1.DaemonService.GetQuickPasteStatus:output_type -> pasteferry.v1.QuickPasteStatus+ 7, // 131: pasteferry.v1.DaemonService.SendQuickPasteCommand:output_type -> pasteferry.v1.Empty+ 73, // 132: pasteferry.v1.DaemonService.SendFiles:output_type -> pasteferry.v1.Transfer+ 7, // 133: pasteferry.v1.DaemonService.CancelTransfer:output_type -> pasteferry.v1.Empty+ 7, // 134: pasteferry.v1.DaemonService.ResumeTransfer:output_type -> pasteferry.v1.Empty+ 76, // 135: pasteferry.v1.DaemonService.ListTransfers:output_type -> pasteferry.v1.ListTransfersResponse+ 7, // 136: pasteferry.v1.DaemonService.DeleteTransfers:output_type -> pasteferry.v1.Empty+ 7, // 137: pasteferry.v1.DaemonService.MarkTransfersSeen:output_type -> pasteferry.v1.Empty+ 79, // 138: pasteferry.v1.DaemonService.CheckReceiveDir:output_type -> pasteferry.v1.CheckReceiveDirResponse+ 7, // 139: pasteferry.v1.DaemonService.AnswerIncoming:output_type -> pasteferry.v1.Empty+ 14, // 140: pasteferry.v1.DaemonService.GetProfile:output_type -> pasteferry.v1.Profile+ 14, // 141: pasteferry.v1.DaemonService.SetDisplayName:output_type -> pasteferry.v1.Profile+ 14, // 142: pasteferry.v1.DaemonService.SetAvatar:output_type -> pasteferry.v1.Profile+ 14, // 143: pasteferry.v1.DaemonService.ResetAvatar:output_type -> pasteferry.v1.Profile+ 18, // 144: pasteferry.v1.DaemonService.GetAvatar:output_type -> pasteferry.v1.Avatar+ 41, // 145: pasteferry.v1.DaemonService.CreateFriendCode:output_type -> pasteferry.v1.CreatePairingCodeResponse+ 23, // 146: pasteferry.v1.DaemonService.RedeemFriendCode:output_type -> pasteferry.v1.FriendRequest+ 7, // 147: pasteferry.v1.DaemonService.ConfirmFriend:output_type -> pasteferry.v1.Empty+ 22, // 148: pasteferry.v1.DaemonService.ListFriends:output_type -> pasteferry.v1.ListFriendsResponse+ 7, // 149: pasteferry.v1.DaemonService.RemoveFriend:output_type -> pasteferry.v1.Empty+ 21, // 150: pasteferry.v1.DaemonService.SetFriendAutoAccept:output_type -> pasteferry.v1.Friend+ 7, // 151: pasteferry.v1.DaemonService.BlockDevice:output_type -> pasteferry.v1.Empty+ 25, // 152: pasteferry.v1.DaemonService.WatchStrangers:output_type -> pasteferry.v1.Strangers+ 97, // [97:153] is the sub-list for method output_type+ 41, // [41:97] is the sub-list for method input_type+ 41, // [41:41] is the sub-list for extension type_name+ 41, // [41:41] is the sub-list for extension extendee+ 0, // [0:41] is the sub-list for field type_name}func init() { file_pasteferry_v1_daemon_proto_init() }@@ -5552,6 +6724,10 @@ func file_pasteferry_v1_daemon_proto_init() {(*Event_TransferChanged)(nil),(*Event_TransferRemoved)(nil),(*Event_Navigate)(nil),+ (*Event_FriendChanged)(nil),+ (*Event_FriendRemoved)(nil),+ (*Event_FriendRequest)(nil),+ (*Event_ProfileChanged)(nil),}type x struct{}out := protoimpl.TypeBuilder{@@ -5559,7 +6735,7 @@ func file_pasteferry_v1_daemon_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_pasteferry_v1_daemon_proto_rawDesc), len(file_pasteferry_v1_daemon_proto_rawDesc)),NumEnums: 7,- NumMessages: 60,+ NumMessages: 73,NumExtensions: 0,NumServices: 1,},diff --git a/proto/gen/pasteferry/v1/daemon_grpc.pb.go b/proto/gen/pasteferry/v1/daemon_grpc.pb.goindex 6e29cc8..d434a78 100644--- a/proto/gen/pasteferry/v1/daemon_grpc.pb.go+++ b/proto/gen/pasteferry/v1/daemon_grpc.pb.go@@ -66,6 +66,20 @@ const (DaemonService_DeleteTransfers_FullMethodName = "/pasteferry.v1.DaemonService/DeleteTransfers"DaemonService_MarkTransfersSeen_FullMethodName = "/pasteferry.v1.DaemonService/MarkTransfersSeen"DaemonService_CheckReceiveDir_FullMethodName = "/pasteferry.v1.DaemonService/CheckReceiveDir"+ DaemonService_AnswerIncoming_FullMethodName = "/pasteferry.v1.DaemonService/AnswerIncoming"+ DaemonService_GetProfile_FullMethodName = "/pasteferry.v1.DaemonService/GetProfile"+ DaemonService_SetDisplayName_FullMethodName = "/pasteferry.v1.DaemonService/SetDisplayName"+ DaemonService_SetAvatar_FullMethodName = "/pasteferry.v1.DaemonService/SetAvatar"+ DaemonService_ResetAvatar_FullMethodName = "/pasteferry.v1.DaemonService/ResetAvatar"+ DaemonService_GetAvatar_FullMethodName = "/pasteferry.v1.DaemonService/GetAvatar"+ DaemonService_CreateFriendCode_FullMethodName = "/pasteferry.v1.DaemonService/CreateFriendCode"+ DaemonService_RedeemFriendCode_FullMethodName = "/pasteferry.v1.DaemonService/RedeemFriendCode"+ DaemonService_ConfirmFriend_FullMethodName = "/pasteferry.v1.DaemonService/ConfirmFriend"+ DaemonService_ListFriends_FullMethodName = "/pasteferry.v1.DaemonService/ListFriends"+ DaemonService_RemoveFriend_FullMethodName = "/pasteferry.v1.DaemonService/RemoveFriend"+ DaemonService_SetFriendAutoAccept_FullMethodName = "/pasteferry.v1.DaemonService/SetFriendAutoAccept"+ DaemonService_BlockDevice_FullMethodName = "/pasteferry.v1.DaemonService/BlockDevice"+ DaemonService_WatchStrangers_FullMethodName = "/pasteferry.v1.DaemonService/WatchStrangers")// DaemonServiceClient is the client API for DaemonService service.@@ -155,6 +169,28 @@ type DaemonServiceClient interface {// 检查保存位置能否写入。path 为空时检查当前设置的位置。// 在 macOS 上会在这时触发系统的文件夹授权弹窗,所以要在用户看着界面时调用CheckReceiveDir(ctx context.Context, in *CheckReceiveDirRequest, opts ...grpc.CallOption) (*CheckReceiveDirResponse, error)+ // 别人发来的、在等用户接受的一批:接受或拒绝。always 表示以后自动接收这个好友的文件+ AnswerIncoming(ctx context.Context, in *AnswerIncomingRequest, opts ...grpc.CallOption) (*Empty, error)+ // ── 好友,见 design/friends-send.md ──+ GetProfile(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Profile, error)+ SetDisplayName(ctx context.Context, in *SetDisplayNameRequest, opts ...grpc.CallOption) (*Profile, error)+ // 设置头像:图片文件或剪贴板里的图片,按裁剪区域裁成正方形,处理成 256×256 的 JPEG+ SetAvatar(ctx context.Context, in *SetAvatarRequest, opts ...grpc.CallOption) (*Profile, error)+ ResetAvatar(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Profile, error)+ // 本机或某个好友的头像(JPEG)。没有自定义头像时为空+ GetAvatar(ctx context.Context, in *GetAvatarRequest, opts ...grpc.CallOption) (*Avatar, error)+ // 生成好友码(F 加 6 位),5 分钟有效。别人兑换后推送 friend_request 事件+ CreateFriendCode(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CreatePairingCodeResponse, error)+ // 输入好友码,返回对方的名片和会话;用户在确认框里点了以后调 ConfirmFriend+ RedeemFriendCode(ctx context.Context, in *RedeemPairingCodeRequest, opts ...grpc.CallOption) (*FriendRequest, error)+ ConfirmFriend(ctx context.Context, in *ConfirmPairingRequest, opts ...grpc.CallOption) (*Empty, error)+ ListFriends(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListFriendsResponse, error)+ RemoveFriend(ctx context.Context, in *FriendRef, opts ...grpc.CallOption) (*Empty, error)+ SetFriendAutoAccept(ctx context.Context, in *SetFriendAutoAcceptRequest, opts ...grpc.CallOption) (*Friend, error)+ // 「所有人」模式下拒绝过的陌生设备,以后它的请求直接拒绝+ BlockDevice(ctx context.Context, in *FriendRef, opts ...grpc.CallOption) (*Empty, error)+ // 隔空传送页打开期间保持这个调用:推送附近开着「所有人」的陌生设备(只在局域网里)+ WatchStrangers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Strangers], error)}type daemonServiceClient struct {@@ -615,6 +651,155 @@ func (c *daemonServiceClient) CheckReceiveDir(ctx context.Context, in *CheckRecereturn out, nil}+func (c *daemonServiceClient) AnswerIncoming(ctx context.Context, in *AnswerIncomingRequest, opts ...grpc.CallOption) (*Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Empty)+ err := c.cc.Invoke(ctx, DaemonService_AnswerIncoming_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) GetProfile(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Profile, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Profile)+ err := c.cc.Invoke(ctx, DaemonService_GetProfile_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) SetDisplayName(ctx context.Context, in *SetDisplayNameRequest, opts ...grpc.CallOption) (*Profile, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Profile)+ err := c.cc.Invoke(ctx, DaemonService_SetDisplayName_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) SetAvatar(ctx context.Context, in *SetAvatarRequest, opts ...grpc.CallOption) (*Profile, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Profile)+ err := c.cc.Invoke(ctx, DaemonService_SetAvatar_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) ResetAvatar(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Profile, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Profile)+ err := c.cc.Invoke(ctx, DaemonService_ResetAvatar_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) GetAvatar(ctx context.Context, in *GetAvatarRequest, opts ...grpc.CallOption) (*Avatar, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Avatar)+ err := c.cc.Invoke(ctx, DaemonService_GetAvatar_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) CreateFriendCode(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CreatePairingCodeResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(CreatePairingCodeResponse)+ err := c.cc.Invoke(ctx, DaemonService_CreateFriendCode_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) RedeemFriendCode(ctx context.Context, in *RedeemPairingCodeRequest, opts ...grpc.CallOption) (*FriendRequest, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(FriendRequest)+ err := c.cc.Invoke(ctx, DaemonService_RedeemFriendCode_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) ConfirmFriend(ctx context.Context, in *ConfirmPairingRequest, opts ...grpc.CallOption) (*Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Empty)+ err := c.cc.Invoke(ctx, DaemonService_ConfirmFriend_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) ListFriends(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListFriendsResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ListFriendsResponse)+ err := c.cc.Invoke(ctx, DaemonService_ListFriends_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) RemoveFriend(ctx context.Context, in *FriendRef, opts ...grpc.CallOption) (*Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Empty)+ err := c.cc.Invoke(ctx, DaemonService_RemoveFriend_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) SetFriendAutoAccept(ctx context.Context, in *SetFriendAutoAcceptRequest, opts ...grpc.CallOption) (*Friend, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Friend)+ err := c.cc.Invoke(ctx, DaemonService_SetFriendAutoAccept_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) BlockDevice(ctx context.Context, in *FriendRef, opts ...grpc.CallOption) (*Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Empty)+ err := c.cc.Invoke(ctx, DaemonService_BlockDevice_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) WatchStrangers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Strangers], error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ stream, err := c.cc.NewStream(ctx, &DaemonService_ServiceDesc.Streams[4], DaemonService_WatchStrangers_FullMethodName, cOpts...)+ if err != nil {+ return nil, err+ }+ x := &grpc.GenericClientStream[Empty, Strangers]{ClientStream: stream}+ if err := x.ClientStream.SendMsg(in); err != nil {+ return nil, err+ }+ if err := x.ClientStream.CloseSend(); err != nil {+ return nil, err+ }+ return x, nil+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type DaemonService_WatchStrangersClient = grpc.ServerStreamingClient[Strangers]+// DaemonServiceServer is the server API for DaemonService service.// All implementations must embed UnimplementedDaemonServiceServer// for forward compatibility.@@ -702,6 +887,28 @@ type DaemonServiceServer interface {// 检查保存位置能否写入。path 为空时检查当前设置的位置。// 在 macOS 上会在这时触发系统的文件夹授权弹窗,所以要在用户看着界面时调用CheckReceiveDir(context.Context, *CheckReceiveDirRequest) (*CheckReceiveDirResponse, error)+ // 别人发来的、在等用户接受的一批:接受或拒绝。always 表示以后自动接收这个好友的文件+ AnswerIncoming(context.Context, *AnswerIncomingRequest) (*Empty, error)+ // ── 好友,见 design/friends-send.md ──+ GetProfile(context.Context, *Empty) (*Profile, error)+ SetDisplayName(context.Context, *SetDisplayNameRequest) (*Profile, error)+ // 设置头像:图片文件或剪贴板里的图片,按裁剪区域裁成正方形,处理成 256×256 的 JPEG+ SetAvatar(context.Context, *SetAvatarRequest) (*Profile, error)+ ResetAvatar(context.Context, *Empty) (*Profile, error)+ // 本机或某个好友的头像(JPEG)。没有自定义头像时为空+ GetAvatar(context.Context, *GetAvatarRequest) (*Avatar, error)+ // 生成好友码(F 加 6 位),5 分钟有效。别人兑换后推送 friend_request 事件+ CreateFriendCode(context.Context, *Empty) (*CreatePairingCodeResponse, error)+ // 输入好友码,返回对方的名片和会话;用户在确认框里点了以后调 ConfirmFriend+ RedeemFriendCode(context.Context, *RedeemPairingCodeRequest) (*FriendRequest, error)+ ConfirmFriend(context.Context, *ConfirmPairingRequest) (*Empty, error)+ ListFriends(context.Context, *Empty) (*ListFriendsResponse, error)+ RemoveFriend(context.Context, *FriendRef) (*Empty, error)+ SetFriendAutoAccept(context.Context, *SetFriendAutoAcceptRequest) (*Friend, error)+ // 「所有人」模式下拒绝过的陌生设备,以后它的请求直接拒绝+ BlockDevice(context.Context, *FriendRef) (*Empty, error)+ // 隔空传送页打开期间保持这个调用:推送附近开着「所有人」的陌生设备(只在局域网里)+ WatchStrangers(*Empty, grpc.ServerStreamingServer[Strangers]) errormustEmbedUnimplementedDaemonServiceServer()}@@ -838,6 +1045,48 @@ func (UnimplementedDaemonServiceServer) MarkTransfersSeen(context.Context, *Emptfunc (UnimplementedDaemonServiceServer) CheckReceiveDir(context.Context, *CheckReceiveDirRequest) (*CheckReceiveDirResponse, error) {return nil, status.Error(codes.Unimplemented, "method CheckReceiveDir not implemented")}+func (UnimplementedDaemonServiceServer) AnswerIncoming(context.Context, *AnswerIncomingRequest) (*Empty, error) {+ return nil, status.Error(codes.Unimplemented, "method AnswerIncoming not implemented")+}+func (UnimplementedDaemonServiceServer) GetProfile(context.Context, *Empty) (*Profile, error) {+ return nil, status.Error(codes.Unimplemented, "method GetProfile not implemented")+}+func (UnimplementedDaemonServiceServer) SetDisplayName(context.Context, *SetDisplayNameRequest) (*Profile, error) {+ return nil, status.Error(codes.Unimplemented, "method SetDisplayName not implemented")+}+func (UnimplementedDaemonServiceServer) SetAvatar(context.Context, *SetAvatarRequest) (*Profile, error) {+ return nil, status.Error(codes.Unimplemented, "method SetAvatar not implemented")+}+func (UnimplementedDaemonServiceServer) ResetAvatar(context.Context, *Empty) (*Profile, error) {+ return nil, status.Error(codes.Unimplemented, "method ResetAvatar not implemented")+}+func (UnimplementedDaemonServiceServer) GetAvatar(context.Context, *GetAvatarRequest) (*Avatar, error) {+ return nil, status.Error(codes.Unimplemented, "method GetAvatar not implemented")+}+func (UnimplementedDaemonServiceServer) CreateFriendCode(context.Context, *Empty) (*CreatePairingCodeResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method CreateFriendCode not implemented")+}+func (UnimplementedDaemonServiceServer) RedeemFriendCode(context.Context, *RedeemPairingCodeRequest) (*FriendRequest, error) {+ return nil, status.Error(codes.Unimplemented, "method RedeemFriendCode not implemented")+}+func (UnimplementedDaemonServiceServer) ConfirmFriend(context.Context, *ConfirmPairingRequest) (*Empty, error) {+ return nil, status.Error(codes.Unimplemented, "method ConfirmFriend not implemented")+}+func (UnimplementedDaemonServiceServer) ListFriends(context.Context, *Empty) (*ListFriendsResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method ListFriends not implemented")+}+func (UnimplementedDaemonServiceServer) RemoveFriend(context.Context, *FriendRef) (*Empty, error) {+ return nil, status.Error(codes.Unimplemented, "method RemoveFriend not implemented")+}+func (UnimplementedDaemonServiceServer) SetFriendAutoAccept(context.Context, *SetFriendAutoAcceptRequest) (*Friend, error) {+ return nil, status.Error(codes.Unimplemented, "method SetFriendAutoAccept not implemented")+}+func (UnimplementedDaemonServiceServer) BlockDevice(context.Context, *FriendRef) (*Empty, error) {+ return nil, status.Error(codes.Unimplemented, "method BlockDevice not implemented")+}+func (UnimplementedDaemonServiceServer) WatchStrangers(*Empty, grpc.ServerStreamingServer[Strangers]) error {+ return status.Error(codes.Unimplemented, "method WatchStrangers not implemented")+}func (UnimplementedDaemonServiceServer) mustEmbedUnimplementedDaemonServiceServer() {}func (UnimplementedDaemonServiceServer) testEmbeddedByValue() {}@@ -1583,6 +1832,251 @@ func _DaemonService_CheckReceiveDir_Handler(srv interface{}, ctx context.Contextreturn interceptor(ctx, in, info, handler)}+func _DaemonService_AnswerIncoming_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(AnswerIncomingRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).AnswerIncoming(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_AnswerIncoming_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).AnswerIncoming(ctx, req.(*AnswerIncomingRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_GetProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(Empty)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).GetProfile(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_GetProfile_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).GetProfile(ctx, req.(*Empty))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_SetDisplayName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(SetDisplayNameRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).SetDisplayName(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_SetDisplayName_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).SetDisplayName(ctx, req.(*SetDisplayNameRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_SetAvatar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(SetAvatarRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).SetAvatar(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_SetAvatar_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).SetAvatar(ctx, req.(*SetAvatarRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_ResetAvatar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(Empty)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).ResetAvatar(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_ResetAvatar_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).ResetAvatar(ctx, req.(*Empty))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_GetAvatar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(GetAvatarRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).GetAvatar(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_GetAvatar_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).GetAvatar(ctx, req.(*GetAvatarRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_CreateFriendCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(Empty)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).CreateFriendCode(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_CreateFriendCode_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).CreateFriendCode(ctx, req.(*Empty))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_RedeemFriendCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(RedeemPairingCodeRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).RedeemFriendCode(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_RedeemFriendCode_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).RedeemFriendCode(ctx, req.(*RedeemPairingCodeRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_ConfirmFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ConfirmPairingRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).ConfirmFriend(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_ConfirmFriend_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).ConfirmFriend(ctx, req.(*ConfirmPairingRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_ListFriends_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(Empty)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).ListFriends(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_ListFriends_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).ListFriends(ctx, req.(*Empty))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_RemoveFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(FriendRef)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).RemoveFriend(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_RemoveFriend_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).RemoveFriend(ctx, req.(*FriendRef))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_SetFriendAutoAccept_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(SetFriendAutoAcceptRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).SetFriendAutoAccept(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_SetFriendAutoAccept_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).SetFriendAutoAccept(ctx, req.(*SetFriendAutoAcceptRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_BlockDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(FriendRef)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).BlockDevice(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_BlockDevice_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).BlockDevice(ctx, req.(*FriendRef))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_WatchStrangers_Handler(srv interface{}, stream grpc.ServerStream) error {+ m := new(Empty)+ if err := stream.RecvMsg(m); err != nil {+ return err+ }+ return srv.(DaemonServiceServer).WatchStrangers(m, &grpc.GenericServerStream[Empty, Strangers]{ServerStream: stream})+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type DaemonService_WatchStrangersServer = grpc.ServerStreamingServer[Strangers]+// DaemonService_ServiceDesc is the grpc.ServiceDesc for DaemonService service.// It's only intended for direct use with grpc.RegisterService,// and not to be introspected or modified (even as a copy)@@ -1742,6 +2236,58 @@ var DaemonService_ServiceDesc = grpc.ServiceDesc{MethodName: "CheckReceiveDir",Handler: _DaemonService_CheckReceiveDir_Handler,},+ {+ MethodName: "AnswerIncoming",+ Handler: _DaemonService_AnswerIncoming_Handler,+ },+ {+ MethodName: "GetProfile",+ Handler: _DaemonService_GetProfile_Handler,+ },+ {+ MethodName: "SetDisplayName",+ Handler: _DaemonService_SetDisplayName_Handler,+ },+ {+ MethodName: "SetAvatar",+ Handler: _DaemonService_SetAvatar_Handler,+ },+ {+ MethodName: "ResetAvatar",+ Handler: _DaemonService_ResetAvatar_Handler,+ },+ {+ MethodName: "GetAvatar",+ Handler: _DaemonService_GetAvatar_Handler,+ },+ {+ MethodName: "CreateFriendCode",+ Handler: _DaemonService_CreateFriendCode_Handler,+ },+ {+ MethodName: "RedeemFriendCode",+ Handler: _DaemonService_RedeemFriendCode_Handler,+ },+ {+ MethodName: "ConfirmFriend",+ Handler: _DaemonService_ConfirmFriend_Handler,+ },+ {+ MethodName: "ListFriends",+ Handler: _DaemonService_ListFriends_Handler,+ },+ {+ MethodName: "RemoveFriend",+ Handler: _DaemonService_RemoveFriend_Handler,+ },+ {+ MethodName: "SetFriendAutoAccept",+ Handler: _DaemonService_SetFriendAutoAccept_Handler,+ },+ {+ MethodName: "BlockDevice",+ Handler: _DaemonService_BlockDevice_Handler,+ },},Streams: []grpc.StreamDesc{{@@ -1765,6 +2311,11 @@ var DaemonService_ServiceDesc = grpc.ServiceDesc{ServerStreams: true,ClientStreams: true,},+ {+ StreamName: "WatchStrangers",+ Handler: _DaemonService_WatchStrangers_Handler,+ ServerStreams: true,+ },},Metadata: "pasteferry/v1/daemon.proto",}diff --git a/proto/gen/pasteferry/v1/wire.pb.go b/proto/gen/pasteferry/v1/wire.pb.goindex 00bde1b..d8a2dea 100644--- a/proto/gen/pasteferry/v1/wire.pb.go+++ b/proto/gen/pasteferry/v1/wire.pb.go@@ -209,6 +209,10 @@ type SignalMessage struct {// *SignalMessage_Ping// *SignalMessage_LanHello// *SignalMessage_RetryDirect+ // *SignalMessage_PairIntent+ // *SignalMessage_FriendConfirm+ // *SignalMessage_StrangerHello+ // *SignalMessage_FriendRemovePayload isSignalMessage_Payload `protobuf_oneof:"payload"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -354,6 +358,42 @@ func (x *SignalMessage) GetRetryDirect() *RetryDirect {return nil}+func (x *SignalMessage) GetPairIntent() *PairIntent {+ if x != nil {+ if x, ok := x.Payload.(*SignalMessage_PairIntent); ok {+ return x.PairIntent+ }+ }+ return nil+}++func (x *SignalMessage) GetFriendConfirm() *FriendConfirm {+ if x != nil {+ if x, ok := x.Payload.(*SignalMessage_FriendConfirm); ok {+ return x.FriendConfirm+ }+ }+ return nil+}++func (x *SignalMessage) GetStrangerHello() *StrangerHello {+ if x != nil {+ if x, ok := x.Payload.(*SignalMessage_StrangerHello); ok {+ return x.StrangerHello+ }+ }+ return nil+}++func (x *SignalMessage) GetFriendRemove() *FriendRemove {+ if x != nil {+ if x, ok := x.Payload.(*SignalMessage_FriendRemove); ok {+ return x.FriendRemove+ }+ }+ return nil+}+type isSignalMessage_Payload interface {isSignalMessage_Payload()}@@ -382,6 +422,26 @@ type SignalMessage_RetryDirect struct {RetryDirect *RetryDirect `protobuf:"bytes,15,opt,name=retry_direct,json=retryDirect,proto3,oneof"`}+type SignalMessage_PairIntent struct {+ // 配对码兑换后、用户确认前,两边告诉对方这次是配对还是加好友(2.6.0)。+ // 旧版本不发:没收到就当作配对+ PairIntent *PairIntent `protobuf:"bytes,16,opt,name=pair_intent,json=pairIntent,proto3,oneof"`+}++type SignalMessage_FriendConfirm struct {+ // 加好友:本端的用户点了「添加」或「取消」。两边都添加了才算好友+ FriendConfirm *FriendConfirm `protobuf:"bytes,17,opt,name=friend_confirm,json=friendConfirm,proto3,oneof"`+}++type SignalMessage_StrangerHello struct {+ // 「所有人」模式下陌生设备之间交换的名片,见 design/friends-send.md 第 9.1 节+ StrangerHello *StrangerHello `protobuf:"bytes,18,opt,name=stranger_hello,json=strangerHello,proto3,oneof"`+}++type SignalMessage_FriendRemove struct {+ FriendRemove *FriendRemove `protobuf:"bytes,19,opt,name=friend_remove,json=friendRemove,proto3,oneof"`+}+func (*SignalMessage_Offer) isSignalMessage_Payload() {}func (*SignalMessage_Answer) isSignalMessage_Payload() {}@@ -394,6 +454,166 @@ func (*SignalMessage_LanHello) isSignalMessage_Payload() {}func (*SignalMessage_RetryDirect) isSignalMessage_Payload() {}+func (*SignalMessage_PairIntent) isSignalMessage_Payload() {}++func (*SignalMessage_FriendConfirm) isSignalMessage_Payload() {}++func (*SignalMessage_StrangerHello) isSignalMessage_Payload() {}++func (*SignalMessage_FriendRemove) isSignalMessage_Payload() {}++// 配对码兑换后各自发一次,直到收到对方的。intent 是 "device"(配对)或 "friend"(加好友)+type PairIntent struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Intent string `protobuf:"bytes,1,opt,name=intent,proto3" json:"intent,omitempty"`+ // 加好友时带上名片,确认框里显示对方的名字+ Card *FriendCard `protobuf:"bytes,2,opt,name=card,proto3" json:"card,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *PairIntent) Reset() {+ *x = PairIntent{}+ mi := &file_pasteferry_v1_wire_proto_msgTypes[2]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *PairIntent) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PairIntent) ProtoMessage() {}++func (x *PairIntent) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_wire_proto_msgTypes[2]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PairIntent.ProtoReflect.Descriptor instead.+func (*PairIntent) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{2}+}++func (x *PairIntent) GetIntent() string {+ if x != nil {+ return x.Intent+ }+ return ""+}++func (x *PairIntent) GetCard() *FriendCard {+ if x != nil {+ return x.Card+ }+ return nil+}++type FriendConfirm struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Accepted bool `protobuf:"varint,1,opt,name=accepted,proto3" json:"accepted,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *FriendConfirm) Reset() {+ *x = FriendConfirm{}+ mi := &file_pasteferry_v1_wire_proto_msgTypes[3]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *FriendConfirm) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*FriendConfirm) ProtoMessage() {}++func (x *FriendConfirm) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_wire_proto_msgTypes[3]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use FriendConfirm.ProtoReflect.Descriptor instead.+func (*FriendConfirm) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{3}+}++func (x *FriendConfirm) GetAccepted() bool {+ if x != nil {+ return x.Accepted+ }+ return false+}++// 「所有人」模式:发送方先发,接收方开着「所有人」时回一条(reply = true)。+// 公钥随签名的局域网配对信息交换(见 LanPacket.stranger),这里只带显示用的名片+type StrangerHello struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Card *FriendCard `protobuf:"bytes,1,opt,name=card,proto3" json:"card,omitempty"`+ Reply bool `protobuf:"varint,2,opt,name=reply,proto3" json:"reply,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *StrangerHello) Reset() {+ *x = StrangerHello{}+ mi := &file_pasteferry_v1_wire_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *StrangerHello) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*StrangerHello) ProtoMessage() {}++func (x *StrangerHello) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_wire_proto_msgTypes[4]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use StrangerHello.ProtoReflect.Descriptor instead.+func (*StrangerHello) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{4}+}++func (x *StrangerHello) GetCard() *FriendCard {+ if x != nil {+ return x.Card+ }+ return nil+}++func (x *StrangerHello) GetReply() bool {+ if x != nil {+ return x.Reply+ }+ return false+}+// 用户在应答方点了「重新连接」:只有发起方能做 ICE 重启,请它马上再试一次直连。// 旧版本不认识它,照旧按自己的间隔重试type RetryDirect struct {@@ -404,7 +624,7 @@ type RetryDirect struct {func (x *RetryDirect) Reset() {*x = RetryDirect{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[2]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -416,7 +636,7 @@ func (x *RetryDirect) String() string {func (*RetryDirect) ProtoMessage() {}func (x *RetryDirect) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[2]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[5]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -429,7 +649,7 @@ func (x *RetryDirect) ProtoReflect() protoreflect.Message {// Deprecated: Use RetryDirect.ProtoReflect.Descriptor instead.func (*RetryDirect) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{2}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{5}}type SdpOffer struct {@@ -448,7 +668,7 @@ type SdpOffer struct {func (x *SdpOffer) Reset() {*x = SdpOffer{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[3]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -460,7 +680,7 @@ func (x *SdpOffer) String() string {func (*SdpOffer) ProtoMessage() {}func (x *SdpOffer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[3]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[6]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -473,7 +693,7 @@ func (x *SdpOffer) ProtoReflect() protoreflect.Message {// Deprecated: Use SdpOffer.ProtoReflect.Descriptor instead.func (*SdpOffer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{3}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{6}}func (x *SdpOffer) GetSdp() string {@@ -507,7 +727,7 @@ type SdpAnswer struct {func (x *SdpAnswer) Reset() {*x = SdpAnswer{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[4]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -519,7 +739,7 @@ func (x *SdpAnswer) String() string {func (*SdpAnswer) ProtoMessage() {}func (x *SdpAnswer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[4]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[7]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -532,7 +752,7 @@ func (x *SdpAnswer) ProtoReflect() protoreflect.Message {// Deprecated: Use SdpAnswer.ProtoReflect.Descriptor instead.func (*SdpAnswer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{4}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{7}}func (x *SdpAnswer) GetSdp() string {@@ -560,7 +780,7 @@ type IceCandidate struct {func (x *IceCandidate) Reset() {*x = IceCandidate{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[5]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[8]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -572,7 +792,7 @@ func (x *IceCandidate) String() string {func (*IceCandidate) ProtoMessage() {}func (x *IceCandidate) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[5]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[8]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -585,7 +805,7 @@ func (x *IceCandidate) ProtoReflect() protoreflect.Message {// Deprecated: Use IceCandidate.ProtoReflect.Descriptor instead.func (*IceCandidate) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{5}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{8}}func (x *IceCandidate) GetCandidate() string {@@ -618,7 +838,7 @@ type Ping struct {func (x *Ping) Reset() {*x = Ping{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[6]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[9]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -630,7 +850,7 @@ func (x *Ping) String() string {func (*Ping) ProtoMessage() {}func (x *Ping) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[6]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[9]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -643,7 +863,7 @@ func (x *Ping) ProtoReflect() protoreflect.Message {// Deprecated: Use Ping.ProtoReflect.Descriptor instead.func (*Ping) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{6}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{9}}func (x *Ping) GetSentAtUnix() int64 {@@ -667,7 +887,7 @@ type ClientHello struct {func (x *ClientHello) Reset() {*x = ClientHello{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[7]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[10]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -679,7 +899,7 @@ func (x *ClientHello) String() string {func (*ClientHello) ProtoMessage() {}func (x *ClientHello) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[7]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[10]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -692,7 +912,7 @@ func (x *ClientHello) ProtoReflect() protoreflect.Message {// Deprecated: Use ClientHello.ProtoReflect.Descriptor instead.func (*ClientHello) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{7}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{10}}func (x *ClientHello) GetDeviceId() string {@@ -748,7 +968,7 @@ type ServerHello struct {func (x *ServerHello) Reset() {*x = ServerHello{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[8]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -760,7 +980,7 @@ func (x *ServerHello) String() string {func (*ServerHello) ProtoMessage() {}func (x *ServerHello) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[8]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[11]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -773,7 +993,7 @@ func (x *ServerHello) ProtoReflect() protoreflect.Message {// Deprecated: Use ServerHello.ProtoReflect.Descriptor instead.func (*ServerHello) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{8}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{11}}func (x *ServerHello) GetChallenge() []byte {@@ -809,7 +1029,7 @@ type IceServer struct {func (x *IceServer) Reset() {*x = IceServer{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[9]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[12]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -821,7 +1041,7 @@ func (x *IceServer) String() string {func (*IceServer) ProtoMessage() {}func (x *IceServer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[9]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[12]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -834,7 +1054,7 @@ func (x *IceServer) ProtoReflect() protoreflect.Message {// Deprecated: Use IceServer.ProtoReflect.Descriptor instead.func (*IceServer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{9}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{12}}func (x *IceServer) GetUrls() []string {@@ -875,7 +1095,7 @@ type PeerPresence struct {func (x *PeerPresence) Reset() {*x = PeerPresence{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[10]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[13]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -887,7 +1107,7 @@ func (x *PeerPresence) String() string {func (*PeerPresence) ProtoMessage() {}func (x *PeerPresence) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[10]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[13]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -900,7 +1120,7 @@ func (x *PeerPresence) ProtoReflect() protoreflect.Message {// Deprecated: Use PeerPresence.ProtoReflect.Descriptor instead.func (*PeerPresence) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{10}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{13}}func (x *PeerPresence) GetDeviceId() string {@@ -927,7 +1147,7 @@ type PairingCreateRequest struct {func (x *PairingCreateRequest) Reset() {*x = PairingCreateRequest{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[11]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[14]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -939,7 +1159,7 @@ func (x *PairingCreateRequest) String() string {func (*PairingCreateRequest) ProtoMessage() {}func (x *PairingCreateRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[11]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[14]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -952,7 +1172,7 @@ func (x *PairingCreateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PairingCreateRequest.ProtoReflect.Descriptor instead.func (*PairingCreateRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{11}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{14}}func (x *PairingCreateRequest) GetDeviceName() string {@@ -979,7 +1199,7 @@ type PairingCreateResponse struct {func (x *PairingCreateResponse) Reset() {*x = PairingCreateResponse{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[12]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[15]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -991,7 +1211,7 @@ func (x *PairingCreateResponse) String() string {func (*PairingCreateResponse) ProtoMessage() {}func (x *PairingCreateResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[12]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[15]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1004,7 +1224,7 @@ func (x *PairingCreateResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PairingCreateResponse.ProtoReflect.Descriptor instead.func (*PairingCreateResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{12}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{15}}func (x *PairingCreateResponse) GetCode() string {@@ -1033,7 +1253,7 @@ type PairingRedeemRequest struct {func (x *PairingRedeemRequest) Reset() {*x = PairingRedeemRequest{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[13]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[16]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1045,7 +1265,7 @@ func (x *PairingRedeemRequest) String() string {func (*PairingRedeemRequest) ProtoMessage() {}func (x *PairingRedeemRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[13]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[16]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1058,7 +1278,7 @@ func (x *PairingRedeemRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PairingRedeemRequest.ProtoReflect.Descriptor instead.func (*PairingRedeemRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{13}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{16}}func (x *PairingRedeemRequest) GetCode() string {@@ -1101,7 +1321,7 @@ type PairingRedeemResponse struct {func (x *PairingRedeemResponse) Reset() {*x = PairingRedeemResponse{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[14]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[17]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1113,7 +1333,7 @@ func (x *PairingRedeemResponse) String() string {func (*PairingRedeemResponse) ProtoMessage() {}func (x *PairingRedeemResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[14]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[17]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1126,7 +1346,7 @@ func (x *PairingRedeemResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PairingRedeemResponse.ProtoReflect.Descriptor instead.func (*PairingRedeemResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{14}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{17}}func (x *PairingRedeemResponse) GetPeerDeviceId() string {@@ -1170,7 +1390,7 @@ type PairingRedeemed struct {func (x *PairingRedeemed) Reset() {*x = PairingRedeemed{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[15]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[18]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1182,7 +1402,7 @@ func (x *PairingRedeemed) String() string {func (*PairingRedeemed) ProtoMessage() {}func (x *PairingRedeemed) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[15]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[18]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1195,7 +1415,7 @@ func (x *PairingRedeemed) ProtoReflect() protoreflect.Message {// Deprecated: Use PairingRedeemed.ProtoReflect.Descriptor instead.func (*PairingRedeemed) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{15}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{18}}func (x *PairingRedeemed) GetPeerDeviceId() string {@@ -1237,7 +1457,7 @@ type IceConfig struct {func (x *IceConfig) Reset() {*x = IceConfig{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[16]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1249,7 +1469,7 @@ func (x *IceConfig) String() string {func (*IceConfig) ProtoMessage() {}func (x *IceConfig) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[16]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1262,7 +1482,7 @@ func (x *IceConfig) ProtoReflect() protoreflect.Message {// Deprecated: Use IceConfig.ProtoReflect.Descriptor instead.func (*IceConfig) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{16}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{19}}func (x *IceConfig) GetIceServers() []*IceServer {@@ -1292,7 +1512,7 @@ type ServerEnvelope struct {func (x *ServerEnvelope) Reset() {*x = ServerEnvelope{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[17]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1304,7 +1524,7 @@ func (x *ServerEnvelope) String() string {func (*ServerEnvelope) ProtoMessage() {}func (x *ServerEnvelope) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[17]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1317,7 +1537,7 @@ func (x *ServerEnvelope) ProtoReflect() protoreflect.Message {// Deprecated: Use ServerEnvelope.ProtoReflect.Descriptor instead.func (*ServerEnvelope) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{17}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{20}}func (x *ServerEnvelope) GetPayload() isServerEnvelope_Payload {@@ -1466,7 +1686,7 @@ type ClientEnvelope struct {func (x *ClientEnvelope) Reset() {*x = ClientEnvelope{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[18]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1478,7 +1698,7 @@ func (x *ClientEnvelope) String() string {func (*ClientEnvelope) ProtoMessage() {}func (x *ClientEnvelope) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[18]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1491,7 +1711,7 @@ func (x *ClientEnvelope) ProtoReflect() protoreflect.Message {// Deprecated: Use ClientEnvelope.ProtoReflect.Descriptor instead.func (*ClientEnvelope) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{18}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{21}}func (x *ClientEnvelope) GetPayload() isClientEnvelope_Payload {@@ -1575,7 +1795,7 @@ type ServerError struct {func (x *ServerError) Reset() {*x = ServerError{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[19]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1587,7 +1807,7 @@ func (x *ServerError) String() string {func (*ServerError) ProtoMessage() {}func (x *ServerError) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[19]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1600,7 +1820,7 @@ func (x *ServerError) ProtoReflect() protoreflect.Message {// Deprecated: Use ServerError.ProtoReflect.Descriptor instead.func (*ServerError) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{19}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{22}}func (x *ServerError) GetCode() string {@@ -1627,6 +1847,7 @@ type LanPacket struct {// *LanPacket_PairReject// *LanPacket_NearbyRequest// *LanPacket_NearbyPing+ // *LanPacket_StrangerRequestPayload isLanPacket_Payload `protobuf_oneof:"payload"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -1634,7 +1855,7 @@ type LanPacket struct {func (x *LanPacket) Reset() {*x = LanPacket{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[20]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1646,7 +1867,7 @@ func (x *LanPacket) String() string {func (*LanPacket) ProtoMessage() {}func (x *LanPacket) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[20]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1659,7 +1880,7 @@ func (x *LanPacket) ProtoReflect() protoreflect.Message {// Deprecated: Use LanPacket.ProtoReflect.Descriptor instead.func (*LanPacket) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{20}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{23}}func (x *LanPacket) GetPayload() isLanPacket_Payload {@@ -1723,6 +1944,15 @@ func (x *LanPacket) GetNearbyPing() *LanNearbyPing {return nil}+func (x *LanPacket) GetStrangerRequest() *LanPairSigned {+ if x != nil {+ if x, ok := x.Payload.(*LanPacket_StrangerRequest); ok {+ return x.StrangerRequest+ }+ }+ return nil+}+type isLanPacket_Payload interface {isLanPacket_Payload()}@@ -1751,6 +1981,12 @@ type LanPacket_NearbyPing struct {NearbyPing *LanNearbyPing `protobuf:"bytes,6,opt,name=nearby_ping,json=nearbyPing,proto3,oneof"`}+type LanPacket_StrangerRequest struct {+ // 「所有人」模式(2.6.0):向开着「所有人」的陌生设备要它的公钥,以便给它发文件。+ // 请求与回复都带名片(LanPairInfo.card),不带配对码+ StrangerRequest *LanPairSigned `protobuf:"bytes,7,opt,name=stranger_request,json=strangerRequest,proto3,oneof"`+}+func (*LanPacket_Signal) isLanPacket_Payload() {}func (*LanPacket_PairRequest) isLanPacket_Payload() {}@@ -1763,6 +1999,8 @@ func (*LanPacket_NearbyRequest) isLanPacket_Payload() {}func (*LanPacket_NearbyPing) isLanPacket_Payload() {}+func (*LanPacket_StrangerRequest) isLanPacket_Payload() {}+// 已配对设备之间的上线通知。还没连通时定期发,连通后低频保活。// 两端都往对方发,有状态的防火墙(Windows)会放行对方的包。type LanHello struct {@@ -1779,7 +2017,7 @@ type LanHello struct {func (x *LanHello) Reset() {*x = LanHello{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[21]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1791,7 +2029,7 @@ func (x *LanHello) String() string {func (*LanHello) ProtoMessage() {}func (x *LanHello) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[21]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1804,7 +2042,7 @@ func (x *LanHello) ProtoReflect() protoreflect.Message {// Deprecated: Use LanHello.ProtoReflect.Descriptor instead.func (*LanHello) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{21}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{24}}func (x *LanHello) GetAddresses() []string {@@ -1846,7 +2084,7 @@ type LanPairSigned struct {func (x *LanPairSigned) Reset() {*x = LanPairSigned{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[22]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1858,7 +2096,7 @@ func (x *LanPairSigned) String() string {func (*LanPairSigned) ProtoMessage() {}func (x *LanPairSigned) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[22]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1871,7 +2109,7 @@ func (x *LanPairSigned) ProtoReflect() protoreflect.Message {// Deprecated: Use LanPairSigned.ProtoReflect.Descriptor instead.func (*LanPairSigned) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{22}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{25}}func (x *LanPairSigned) GetPayload() []byte {@@ -1899,13 +2137,18 @@ type LanPairInfo struct {TimestampUnix int64 `protobuf:"varint,7,opt,name=timestamp_unix,json=timestampUnix,proto3" json:"timestamp_unix,omitempty"`Nonce []byte `protobuf:"bytes,8,opt,name=nonce,proto3" json:"nonce,omitempty"`RequestNonce []byte `protobuf:"bytes,9,opt,name=request_nonce,json=requestNonce,proto3" json:"request_nonce,omitempty"` // 回复里回显请求的 nonce,把回复绑定到这次请求+ // 这次是配对("device",旧版本不带)还是加好友("friend",2.6.0)。+ // 显示码的一方发现与自己开放的不一致时回绝(intent_device / intent_friend),不用掉这个码+ Intent string `protobuf:"bytes,10,opt,name=intent,proto3" json:"intent,omitempty"`+ // 加好友时带上名片+ Card *FriendCard `protobuf:"bytes,11,opt,name=card,proto3" json:"card,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}func (x *LanPairInfo) Reset() {*x = LanPairInfo{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[23]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1917,7 +2160,7 @@ func (x *LanPairInfo) String() string {func (*LanPairInfo) ProtoMessage() {}func (x *LanPairInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[23]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1930,7 +2173,7 @@ func (x *LanPairInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use LanPairInfo.ProtoReflect.Descriptor instead.func (*LanPairInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{23}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{26}}func (x *LanPairInfo) GetCode() string {@@ -1996,6 +2239,20 @@ func (x *LanPairInfo) GetRequestNonce() []byte {return nil}+func (x *LanPairInfo) GetIntent() string {+ if x != nil {+ return x.Intent+ }+ return ""+}++func (x *LanPairInfo) GetCard() *FriendCard {+ if x != nil {+ return x.Card+ }+ return nil+}+type LanPairReject struct {state protoimpl.MessageState `protogen:"open.v1"`RequestNonce []byte `protobuf:"bytes,1,opt,name=request_nonce,json=requestNonce,proto3" json:"request_nonce,omitempty"`@@ -2006,7 +2263,7 @@ type LanPairReject struct {func (x *LanPairReject) Reset() {*x = LanPairReject{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[24]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2018,7 +2275,7 @@ func (x *LanPairReject) String() string {func (*LanPairReject) ProtoMessage() {}func (x *LanPairReject) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[24]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2031,7 +2288,7 @@ func (x *LanPairReject) ProtoReflect() protoreflect.Message {// Deprecated: Use LanPairReject.ProtoReflect.Descriptor instead.func (*LanPairReject) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{24}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{27}}func (x *LanPairReject) GetRequestNonce() []byte {@@ -2060,7 +2317,7 @@ type LanNearbyPing struct {func (x *LanNearbyPing) Reset() {*x = LanNearbyPing{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[25]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2072,7 +2329,7 @@ func (x *LanNearbyPing) String() string {func (*LanNearbyPing) ProtoMessage() {}func (x *LanNearbyPing) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[25]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2085,7 +2342,7 @@ func (x *LanNearbyPing) ProtoReflect() protoreflect.Message {// Deprecated: Use LanNearbyPing.ProtoReflect.Descriptor instead.func (*LanNearbyPing) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{25}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{28}}func (x *LanNearbyPing) GetInstance() string {@@ -2133,6 +2390,9 @@ type PeerMessage struct {// *PeerMessage_SendAnswer// *PeerMessage_SendCancel// *PeerMessage_SendResult+ // *PeerMessage_FriendCard+ // *PeerMessage_AvatarRequest+ // *PeerMessage_AvatarDataPayload isPeerMessage_Payload `protobuf_oneof:"payload"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -2140,7 +2400,7 @@ type PeerMessage struct {func (x *PeerMessage) Reset() {*x = PeerMessage{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[26]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[29]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2152,7 +2412,7 @@ func (x *PeerMessage) String() string {func (*PeerMessage) ProtoMessage() {}func (x *PeerMessage) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[26]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[29]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2165,7 +2425,7 @@ func (x *PeerMessage) ProtoReflect() protoreflect.Message {// Deprecated: Use PeerMessage.ProtoReflect.Descriptor instead.func (*PeerMessage) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{26}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{29}}func (x *PeerMessage) GetPayload() isPeerMessage_Payload {@@ -2220,145 +2480,429 @@ func (x *PeerMessage) GetDone() *TransferDone {return nil}-func (x *PeerMessage) GetLink() *LinkInfo {+func (x *PeerMessage) GetLink() *LinkInfo {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_Link); ok {+ return x.Link+ }+ }+ return nil+}++func (x *PeerMessage) GetDisplay() *PeerDisplay {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_Display); ok {+ return x.Display+ }+ }+ return nil+}++func (x *PeerMessage) GetFeatures() *PeerFeatures {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_Features); ok {+ return x.Features+ }+ }+ return nil+}++func (x *PeerMessage) GetSendOffer() *SendOffer {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_SendOffer); ok {+ return x.SendOffer+ }+ }+ return nil+}++func (x *PeerMessage) GetSendAnswer() *SendAnswer {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_SendAnswer); ok {+ return x.SendAnswer+ }+ }+ return nil+}++func (x *PeerMessage) GetSendCancel() *SendCancel {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_SendCancel); ok {+ return x.SendCancel+ }+ }+ return nil+}++func (x *PeerMessage) GetSendResult() *SendResult {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_SendResult); ok {+ return x.SendResult+ }+ }+ return nil+}++func (x *PeerMessage) GetFriendCard() *FriendCard {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_FriendCard); ok {+ return x.FriendCard+ }+ }+ return nil+}++func (x *PeerMessage) GetAvatarRequest() *AvatarRequest {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_AvatarRequest); ok {+ return x.AvatarRequest+ }+ }+ return nil+}++func (x *PeerMessage) GetAvatarData() *AvatarData {+ if x != nil {+ if x, ok := x.Payload.(*PeerMessage_AvatarData); ok {+ return x.AvatarData+ }+ }+ return nil+}++type isPeerMessage_Payload interface {+ isPeerMessage_Payload()+}++type PeerMessage_Offer struct {+ Offer *ClipOffer `protobuf:"bytes,1,opt,name=offer,proto3,oneof"` // 广播:我这边复制了东西+}++type PeerMessage_Fetch struct {+ Fetch *PeerFetch `protobuf:"bytes,2,opt,name=fetch,proto3,oneof"` // 请求:把某条内容发给我+}++type PeerMessage_Reject struct {+ Reject *FetchReject `protobuf:"bytes,3,opt,name=reject,proto3,oneof"` // 拒绝:源文件没了 / 已过期+}++type PeerMessage_Header struct {+ Header *TransferHeader `protobuf:"bytes,4,opt,name=header,proto3,oneof"` // 数据流即将开始+}++type PeerMessage_Done struct {+ Done *TransferDone `protobuf:"bytes,5,opt,name=done,proto3,oneof"`+}++type PeerMessage_Link struct {+ Link *LinkInfo `protobuf:"bytes,6,opt,name=link,proto3,oneof"` // 连接建立后互相告知本端是否经中转+}++type PeerMessage_Display struct {+ Display *PeerDisplay `protobuf:"bytes,7,opt,name=display,proto3,oneof"` // 仅通过加密的设备间通道交换真实名称+}++type PeerMessage_Features struct {+ Features *PeerFeatures `protobuf:"bytes,8,opt,name=features,proto3,oneof"` // 连接建立后互相告知本端支持哪些功能+}++type PeerMessage_SendOffer struct {+ // 隔空传送:把文件直接发给某一台设备,见 design/send-files.md+ SendOffer *SendOffer `protobuf:"bytes,9,opt,name=send_offer,json=sendOffer,proto3,oneof"`+}++type PeerMessage_SendAnswer struct {+ SendAnswer *SendAnswer `protobuf:"bytes,10,opt,name=send_answer,json=sendAnswer,proto3,oneof"`+}++type PeerMessage_SendCancel struct {+ SendCancel *SendCancel `protobuf:"bytes,11,opt,name=send_cancel,json=sendCancel,proto3,oneof"`+}++type PeerMessage_SendResult struct {+ SendResult *SendResult `protobuf:"bytes,12,opt,name=send_result,json=sendResult,proto3,oneof"`+}++type PeerMessage_FriendCard struct {+ // 好友(2.6.0):连上后各自发一次名片;名片里的头像哈希变了才要头像+ FriendCard *FriendCard `protobuf:"bytes,13,opt,name=friend_card,json=friendCard,proto3,oneof"`+}++type PeerMessage_AvatarRequest struct {+ AvatarRequest *AvatarRequest `protobuf:"bytes,14,opt,name=avatar_request,json=avatarRequest,proto3,oneof"`+}++type PeerMessage_AvatarData struct {+ AvatarData *AvatarData `protobuf:"bytes,15,opt,name=avatar_data,json=avatarData,proto3,oneof"`+}++func (*PeerMessage_Offer) isPeerMessage_Payload() {}++func (*PeerMessage_Fetch) isPeerMessage_Payload() {}++func (*PeerMessage_Reject) isPeerMessage_Payload() {}++func (*PeerMessage_Header) isPeerMessage_Payload() {}++func (*PeerMessage_Done) isPeerMessage_Payload() {}++func (*PeerMessage_Link) isPeerMessage_Payload() {}++func (*PeerMessage_Display) isPeerMessage_Payload() {}++func (*PeerMessage_Features) isPeerMessage_Payload() {}++func (*PeerMessage_SendOffer) isPeerMessage_Payload() {}++func (*PeerMessage_SendAnswer) isPeerMessage_Payload() {}++func (*PeerMessage_SendCancel) isPeerMessage_Payload() {}++func (*PeerMessage_SendResult) isPeerMessage_Payload() {}++func (*PeerMessage_FriendCard) isPeerMessage_Payload() {}++func (*PeerMessage_AvatarRequest) isPeerMessage_Payload() {}++func (*PeerMessage_AvatarData) isPeerMessage_Payload() {}++// 好友看到的本机信息。只在加密通道里、发给好友或陌生设备+type FriendCard struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`+ DeviceName string `protobuf:"bytes,2,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"`+ Platform string `protobuf:"bytes,3,opt,name=platform,proto3" json:"platform,omitempty"`+ // 本机用的是哪种服务:official / custom / lan,判断两边能不能跨网络找到对方+ Service string `protobuf:"bytes,4,opt,name=service,proto3" json:"service,omitempty"`+ // 自建服务器地址的哈希(SHA-256 的前 16 字节),判断是不是同一台;不带地址本身+ CustomServerHash []byte `protobuf:"bytes,5,opt,name=custom_server_hash,json=customServerHash,proto3" json:"custom_server_hash,omitempty"`+ // 头像的哈希,空表示用默认头像+ AvatarHash []byte `protobuf:"bytes,6,opt,name=avatar_hash,json=avatarHash,proto3" json:"avatar_hash,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *FriendCard) Reset() {+ *x = FriendCard{}+ mi := &file_pasteferry_v1_wire_proto_msgTypes[30]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *FriendCard) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*FriendCard) ProtoMessage() {}++func (x *FriendCard) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_wire_proto_msgTypes[30]if x != nil {- if x, ok := x.Payload.(*PeerMessage_Link); ok {- return x.Link+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)}+ return ms}- return nil+ return mi.MessageOf(x)}-func (x *PeerMessage) GetDisplay() *PeerDisplay {+// Deprecated: Use FriendCard.ProtoReflect.Descriptor instead.+func (*FriendCard) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{30}+}++func (x *FriendCard) GetDisplayName() string {if x != nil {- if x, ok := x.Payload.(*PeerMessage_Display); ok {- return x.Display- }+ return x.DisplayName}- return nil+ return ""}-func (x *PeerMessage) GetFeatures() *PeerFeatures {+func (x *FriendCard) GetDeviceName() string {if x != nil {- if x, ok := x.Payload.(*PeerMessage_Features); ok {- return x.Features- }+ return x.DeviceName}- return nil+ return ""}-func (x *PeerMessage) GetSendOffer() *SendOffer {+func (x *FriendCard) GetPlatform() string {if x != nil {- if x, ok := x.Payload.(*PeerMessage_SendOffer); ok {- return x.SendOffer- }+ return x.Platform}- return nil+ return ""}-func (x *PeerMessage) GetSendAnswer() *SendAnswer {+func (x *FriendCard) GetService() string {if x != nil {- if x, ok := x.Payload.(*PeerMessage_SendAnswer); ok {- return x.SendAnswer- }+ return x.Service}- return nil+ return ""}-func (x *PeerMessage) GetSendCancel() *SendCancel {+func (x *FriendCard) GetCustomServerHash() []byte {if x != nil {- if x, ok := x.Payload.(*PeerMessage_SendCancel); ok {- return x.SendCancel- }+ return x.CustomServerHash}return nil}-func (x *PeerMessage) GetSendResult() *SendResult {+func (x *FriendCard) GetAvatarHash() []byte {if x != nil {- if x, ok := x.Payload.(*PeerMessage_SendResult); ok {- return x.SendResult- }+ return x.AvatarHash}return nil}-type isPeerMessage_Payload interface {- isPeerMessage_Payload()+// 删除好友。走签名的信令(不用先建 P2P 连接);收到的一方删掉后回一条 ack = true,+// 发出的一方收到回执才不再补发+type FriendRemove struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ AtUnix int64 `protobuf:"varint,1,opt,name=at_unix,json=atUnix,proto3" json:"at_unix,omitempty"`+ Ack bool `protobuf:"varint,2,opt,name=ack,proto3" json:"ack,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}-type PeerMessage_Offer struct {- Offer *ClipOffer `protobuf:"bytes,1,opt,name=offer,proto3,oneof"` // 广播:我这边复制了东西+func (x *FriendRemove) Reset() {+ *x = FriendRemove{}+ mi := &file_pasteferry_v1_wire_proto_msgTypes[31]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)}-type PeerMessage_Fetch struct {- Fetch *PeerFetch `protobuf:"bytes,2,opt,name=fetch,proto3,oneof"` // 请求:把某条内容发给我+func (x *FriendRemove) String() string {+ return protoimpl.X.MessageStringOf(x)}-type PeerMessage_Reject struct {- Reject *FetchReject `protobuf:"bytes,3,opt,name=reject,proto3,oneof"` // 拒绝:源文件没了 / 已过期-}+func (*FriendRemove) ProtoMessage() {}-type PeerMessage_Header struct {- Header *TransferHeader `protobuf:"bytes,4,opt,name=header,proto3,oneof"` // 数据流即将开始+func (x *FriendRemove) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_wire_proto_msgTypes[31]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)}-type PeerMessage_Done struct {- Done *TransferDone `protobuf:"bytes,5,opt,name=done,proto3,oneof"`+// Deprecated: Use FriendRemove.ProtoReflect.Descriptor instead.+func (*FriendRemove) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{31}}-type PeerMessage_Link struct {- Link *LinkInfo `protobuf:"bytes,6,opt,name=link,proto3,oneof"` // 连接建立后互相告知本端是否经中转+func (x *FriendRemove) GetAtUnix() int64 {+ if x != nil {+ return x.AtUnix+ }+ return 0}-type PeerMessage_Display struct {- Display *PeerDisplay `protobuf:"bytes,7,opt,name=display,proto3,oneof"` // 仅通过加密的设备间通道交换真实名称+func (x *FriendRemove) GetAck() bool {+ if x != nil {+ return x.Ack+ }+ return false}-type PeerMessage_Features struct {- Features *PeerFeatures `protobuf:"bytes,8,opt,name=features,proto3,oneof"` // 连接建立后互相告知本端支持哪些功能+type AvatarRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ AvatarHash []byte `protobuf:"bytes,1,opt,name=avatar_hash,json=avatarHash,proto3" json:"avatar_hash,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}-type PeerMessage_SendOffer struct {- // 隔空传送:把文件直接发给某一台设备,见 design/send-files.md- SendOffer *SendOffer `protobuf:"bytes,9,opt,name=send_offer,json=sendOffer,proto3,oneof"`+func (x *AvatarRequest) Reset() {+ *x = AvatarRequest{}+ mi := &file_pasteferry_v1_wire_proto_msgTypes[32]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)}-type PeerMessage_SendAnswer struct {- SendAnswer *SendAnswer `protobuf:"bytes,10,opt,name=send_answer,json=sendAnswer,proto3,oneof"`+func (x *AvatarRequest) String() string {+ return protoimpl.X.MessageStringOf(x)}-type PeerMessage_SendCancel struct {- SendCancel *SendCancel `protobuf:"bytes,11,opt,name=send_cancel,json=sendCancel,proto3,oneof"`-}+func (*AvatarRequest) ProtoMessage() {}-type PeerMessage_SendResult struct {- SendResult *SendResult `protobuf:"bytes,12,opt,name=send_result,json=sendResult,proto3,oneof"`+func (x *AvatarRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_wire_proto_msgTypes[32]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)}-func (*PeerMessage_Offer) isPeerMessage_Payload() {}--func (*PeerMessage_Fetch) isPeerMessage_Payload() {}--func (*PeerMessage_Reject) isPeerMessage_Payload() {}+// Deprecated: Use AvatarRequest.ProtoReflect.Descriptor instead.+func (*AvatarRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{32}+}-func (*PeerMessage_Header) isPeerMessage_Payload() {}+func (x *AvatarRequest) GetAvatarHash() []byte {+ if x != nil {+ return x.AvatarHash+ }+ return nil+}-func (*PeerMessage_Done) isPeerMessage_Payload() {}+type AvatarData struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ AvatarHash []byte `protobuf:"bytes,1,opt,name=avatar_hash,json=avatarHash,proto3" json:"avatar_hash,omitempty"`+ Jpeg []byte `protobuf:"bytes,2,opt,name=jpeg,proto3" json:"jpeg,omitempty"` // 最大 64 KB+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}-func (*PeerMessage_Link) isPeerMessage_Payload() {}+func (x *AvatarData) Reset() {+ *x = AvatarData{}+ mi := &file_pasteferry_v1_wire_proto_msgTypes[33]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}-func (*PeerMessage_Display) isPeerMessage_Payload() {}+func (x *AvatarData) String() string {+ return protoimpl.X.MessageStringOf(x)+}-func (*PeerMessage_Features) isPeerMessage_Payload() {}+func (*AvatarData) ProtoMessage() {}-func (*PeerMessage_SendOffer) isPeerMessage_Payload() {}+func (x *AvatarData) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_wire_proto_msgTypes[33]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}-func (*PeerMessage_SendAnswer) isPeerMessage_Payload() {}+// Deprecated: Use AvatarData.ProtoReflect.Descriptor instead.+func (*AvatarData) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{33}+}-func (*PeerMessage_SendCancel) isPeerMessage_Payload() {}+func (x *AvatarData) GetAvatarHash() []byte {+ if x != nil {+ return x.AvatarHash+ }+ return nil+}-func (*PeerMessage_SendResult) isPeerMessage_Payload() {}+func (x *AvatarData) GetJpeg() []byte {+ if x != nil {+ return x.Jpeg+ }+ return nil+}// 连接就绪后各自发一次,与 LinkInfo 一起;功能开关变了再发一次。// 旧版本不发,也不认识它,对方据此当作不支持。@@ -2375,7 +2919,7 @@ type PeerFeatures struct {func (x *PeerFeatures) Reset() {*x = PeerFeatures{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[27]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[34]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2387,7 +2931,7 @@ func (x *PeerFeatures) String() string {func (*PeerFeatures) ProtoMessage() {}func (x *PeerFeatures) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[27]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[34]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2400,7 +2944,7 @@ func (x *PeerFeatures) ProtoReflect() protoreflect.Message {// Deprecated: Use PeerFeatures.ProtoReflect.Descriptor instead.func (*PeerFeatures) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{27}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{34}}func (x *PeerFeatures) GetFeatures() []string {@@ -2429,7 +2973,7 @@ type LinkInfo struct {func (x *LinkInfo) Reset() {*x = LinkInfo{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[28]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[35]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2441,7 +2985,7 @@ func (x *LinkInfo) String() string {func (*LinkInfo) ProtoMessage() {}func (x *LinkInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[28]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[35]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2454,7 +2998,7 @@ func (x *LinkInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use LinkInfo.ProtoReflect.Descriptor instead.func (*LinkInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{28}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{35}}func (x *LinkInfo) GetRelayed() bool {@@ -2474,7 +3018,7 @@ type PeerDisplay struct {func (x *PeerDisplay) Reset() {*x = PeerDisplay{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[29]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[36]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2486,7 +3030,7 @@ func (x *PeerDisplay) String() string {func (*PeerDisplay) ProtoMessage() {}func (x *PeerDisplay) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[29]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[36]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2499,7 +3043,7 @@ func (x *PeerDisplay) ProtoReflect() protoreflect.Message {// Deprecated: Use PeerDisplay.ProtoReflect.Descriptor instead.func (*PeerDisplay) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{29}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{36}}func (x *PeerDisplay) GetName() string {@@ -2539,7 +3083,7 @@ type ClipOffer struct {func (x *ClipOffer) Reset() {*x = ClipOffer{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[30]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[37]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2551,7 +3095,7 @@ func (x *ClipOffer) String() string {func (*ClipOffer) ProtoMessage() {}func (x *ClipOffer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[30]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[37]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2564,7 +3108,7 @@ func (x *ClipOffer) ProtoReflect() protoreflect.Message {// Deprecated: Use ClipOffer.ProtoReflect.Descriptor instead.func (*ClipOffer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{30}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{37}}func (x *ClipOffer) GetClipId() string {@@ -2640,7 +3184,7 @@ type PeerFetch struct {func (x *PeerFetch) Reset() {*x = PeerFetch{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[31]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[38]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2652,7 +3196,7 @@ func (x *PeerFetch) String() string {func (*PeerFetch) ProtoMessage() {}func (x *PeerFetch) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[31]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[38]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2665,7 +3209,7 @@ func (x *PeerFetch) ProtoReflect() protoreflect.Message {// Deprecated: Use PeerFetch.ProtoReflect.Descriptor instead.func (*PeerFetch) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{31}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{38}}func (x *PeerFetch) GetClipId() string {@@ -2685,7 +3229,7 @@ type FetchReject struct {func (x *FetchReject) Reset() {*x = FetchReject{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[32]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[39]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2697,7 +3241,7 @@ func (x *FetchReject) String() string {func (*FetchReject) ProtoMessage() {}func (x *FetchReject) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[32]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[39]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2710,7 +3254,7 @@ func (x *FetchReject) ProtoReflect() protoreflect.Message {// Deprecated: Use FetchReject.ProtoReflect.Descriptor instead.func (*FetchReject) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{32}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{39}}func (x *FetchReject) GetClipId() string {@@ -2741,7 +3285,7 @@ type TransferHeader struct {func (x *TransferHeader) Reset() {*x = TransferHeader{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[33]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[40]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2753,7 +3297,7 @@ func (x *TransferHeader) String() string {func (*TransferHeader) ProtoMessage() {}func (x *TransferHeader) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[33]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[40]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2766,7 +3310,7 @@ func (x *TransferHeader) ProtoReflect() protoreflect.Message {// Deprecated: Use TransferHeader.ProtoReflect.Descriptor instead.func (*TransferHeader) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{33}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{40}}func (x *TransferHeader) GetClipId() string {@@ -2817,7 +3361,7 @@ type TransferDone struct {func (x *TransferDone) Reset() {*x = TransferDone{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[34]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[41]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2829,7 +3373,7 @@ func (x *TransferDone) String() string {func (*TransferDone) ProtoMessage() {}func (x *TransferDone) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[34]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[41]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2842,7 +3386,7 @@ func (x *TransferDone) ProtoReflect() protoreflect.Message {// Deprecated: Use TransferDone.ProtoReflect.Descriptor instead.func (*TransferDone) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{34}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{41}}func (x *TransferDone) GetClipId() string {@@ -2893,14 +3437,16 @@ type SendOffer struct {LargestFile int64 `protobuf:"varint,6,opt,name=largest_file,json=largestFile,proto3" json:"largest_file,omitempty"`CreatedAtUnix int64 `protobuf:"varint,7,opt,name=created_at_unix,json=createdAtUnix,proto3" json:"created_at_unix,omitempty"`// 续传:同一个 transfer_id 再次发起- Resume bool `protobuf:"varint,8,opt,name=resume,proto3" json:"resume,omitempty"`+ Resume bool `protobuf:"varint,8,opt,name=resume,proto3" json:"resume,omitempty"`+ // 备注(2.6.0):最多 200 个字符、单行,必须附在文件上+ Note string `protobuf:"bytes,9,opt,name=note,proto3" json:"note,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}func (x *SendOffer) Reset() {*x = SendOffer{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[35]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[42]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2912,7 +3458,7 @@ func (x *SendOffer) String() string {func (*SendOffer) ProtoMessage() {}func (x *SendOffer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[35]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[42]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2925,7 +3471,7 @@ func (x *SendOffer) ProtoReflect() protoreflect.Message {// Deprecated: Use SendOffer.ProtoReflect.Descriptor instead.func (*SendOffer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{35}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{42}}func (x *SendOffer) GetTransferId() string {@@ -2984,6 +3530,13 @@ func (x *SendOffer) GetResume() bool {return false}+func (x *SendOffer) GetNote() string {+ if x != nil {+ return x.Note+ }+ return ""+}+type SendAnswer struct {state protoimpl.MessageState `protogen:"open.v1"`TransferId string `protobuf:"bytes,1,opt,name=transfer_id,json=transferId,proto3" json:"transfer_id,omitempty"`@@ -3004,7 +3557,7 @@ type SendAnswer struct {func (x *SendAnswer) Reset() {*x = SendAnswer{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[36]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[43]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3016,7 +3569,7 @@ func (x *SendAnswer) String() string {func (*SendAnswer) ProtoMessage() {}func (x *SendAnswer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[36]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[43]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3029,7 +3582,7 @@ func (x *SendAnswer) ProtoReflect() protoreflect.Message {// Deprecated: Use SendAnswer.ProtoReflect.Descriptor instead.func (*SendAnswer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{36}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{43}}func (x *SendAnswer) GetTransferId() string {@@ -3100,7 +3653,7 @@ type SendCancel struct {func (x *SendCancel) Reset() {*x = SendCancel{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[37]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[44]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3112,7 +3665,7 @@ func (x *SendCancel) String() string {func (*SendCancel) ProtoMessage() {}func (x *SendCancel) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[37]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[44]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3125,7 +3678,7 @@ func (x *SendCancel) ProtoReflect() protoreflect.Message {// Deprecated: Use SendCancel.ProtoReflect.Descriptor instead.func (*SendCancel) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{37}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{44}}func (x *SendCancel) GetTransferId() string {@@ -3157,7 +3710,7 @@ type SendResult struct {func (x *SendResult) Reset() {*x = SendResult{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[38]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[45]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3169,7 +3722,7 @@ func (x *SendResult) String() string {func (*SendResult) ProtoMessage() {}func (x *SendResult) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[38]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[45]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3182,7 +3735,7 @@ func (x *SendResult) ProtoReflect() protoreflect.Message {// Deprecated: Use SendResult.ProtoReflect.Descriptor instead.func (*SendResult) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{38}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{45}}func (x *SendResult) GetTransferId() string {@@ -3237,7 +3790,7 @@ type SendFrame struct {func (x *SendFrame) Reset() {*x = SendFrame{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[39]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[46]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3249,7 +3802,7 @@ func (x *SendFrame) String() string {func (*SendFrame) ProtoMessage() {}func (x *SendFrame) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[39]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[46]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3262,7 +3815,7 @@ func (x *SendFrame) ProtoReflect() protoreflect.Message {// Deprecated: Use SendFrame.ProtoReflect.Descriptor instead.func (*SendFrame) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{39}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{46}}func (x *SendFrame) GetPayload() isSendFrame_Payload {@@ -3337,7 +3890,7 @@ type SendFileStart struct {func (x *SendFileStart) Reset() {*x = SendFileStart{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[40]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[47]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3349,7 +3902,7 @@ func (x *SendFileStart) String() string {func (*SendFileStart) ProtoMessage() {}func (x *SendFileStart) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[40]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[47]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3362,7 +3915,7 @@ func (x *SendFileStart) ProtoReflect() protoreflect.Message {// Deprecated: Use SendFileStart.ProtoReflect.Descriptor instead.func (*SendFileStart) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{40}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{47}}func (x *SendFileStart) GetIndex() int64 {@@ -3430,7 +3983,7 @@ type SendFileEnd struct {func (x *SendFileEnd) Reset() {*x = SendFileEnd{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[41]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[48]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3442,7 +3995,7 @@ func (x *SendFileEnd) String() string {func (*SendFileEnd) ProtoMessage() {}func (x *SendFileEnd) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[41]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[48]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3455,7 +4008,7 @@ func (x *SendFileEnd) ProtoReflect() protoreflect.Message {// Deprecated: Use SendFileEnd.ProtoReflect.Descriptor instead.func (*SendFileEnd) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{41}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{48}}func (x *SendFileEnd) GetSha256() []byte {@@ -3473,7 +4026,7 @@ type SendStreamEnd struct {func (x *SendStreamEnd) Reset() {*x = SendStreamEnd{}- mi := &file_pasteferry_v1_wire_proto_msgTypes[42]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[49]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3485,7 +4038,7 @@ func (x *SendStreamEnd) String() string {func (*SendStreamEnd) ProtoMessage() {}func (x *SendStreamEnd) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_wire_proto_msgTypes[42]+ mi := &file_pasteferry_v1_wire_proto_msgTypes[49]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3498,7 +4051,7 @@ func (x *SendStreamEnd) ProtoReflect() protoreflect.Message {// Deprecated: Use SendStreamEnd.ProtoReflect.Descriptor instead.func (*SendStreamEnd) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{42}+ return file_pasteferry_v1_wire_proto_rawDescGZIP(), []int{49}}var File_pasteferry_v1_wire_proto protoreflect.FileDescriptor@@ -3509,7 +4062,7 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\x06Signed\x12\x18\n" +"\apayload\x18\x01 \x01(\fR\apayload\x12\x1c\n" +"\tsignature\x18\x02 \x01(\fR\tsignature\x12$\n" +- "\x0efrom_device_id\x18\x03 \x01(\tR\ffromDeviceId\"\xef\x04\n" ++ "\x0efrom_device_id\x18\x03 \x01(\tR\ffromDeviceId\"\xff\x06\n" +"\rSignalMessage\x12%\n" +"\x0etimestamp_unix\x18\x01 \x01(\x03R\rtimestampUnix\x12\x14\n" +"\x05nonce\x18\x02 \x01(\fR\x05nonce\x12 \n" +@@ -3525,8 +4078,22 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\tcandidate\x18\f \x01(\v2\x1b.pasteferry.v1.IceCandidateH\x00R\tcandidate\x12)\n" +"\x04ping\x18\r \x01(\v2\x13.pasteferry.v1.PingH\x00R\x04ping\x126\n" +"\tlan_hello\x18\x0e \x01(\v2\x17.pasteferry.v1.LanHelloH\x00R\blanHello\x12?\n" +- "\fretry_direct\x18\x0f \x01(\v2\x1a.pasteferry.v1.RetryDirectH\x00R\vretryDirectB\t\n" +- "\apayload\"\r\n" ++ "\fretry_direct\x18\x0f \x01(\v2\x1a.pasteferry.v1.RetryDirectH\x00R\vretryDirect\x12<\n" ++ "\vpair_intent\x18\x10 \x01(\v2\x19.pasteferry.v1.PairIntentH\x00R\n" ++ "pairIntent\x12E\n" ++ "\x0efriend_confirm\x18\x11 \x01(\v2\x1c.pasteferry.v1.FriendConfirmH\x00R\rfriendConfirm\x12E\n" ++ "\x0estranger_hello\x18\x12 \x01(\v2\x1c.pasteferry.v1.StrangerHelloH\x00R\rstrangerHello\x12B\n" ++ "\rfriend_remove\x18\x13 \x01(\v2\x1b.pasteferry.v1.FriendRemoveH\x00R\ffriendRemoveB\t\n" ++ "\apayload\"S\n" ++ "\n" ++ "PairIntent\x12\x16\n" ++ "\x06intent\x18\x01 \x01(\tR\x06intent\x12-\n" ++ "\x04card\x18\x02 \x01(\v2\x19.pasteferry.v1.FriendCardR\x04card\"+\n" ++ "\rFriendConfirm\x12\x1a\n" ++ "\baccepted\x18\x01 \x01(\bR\baccepted\"T\n" ++ "\rStrangerHello\x12-\n" ++ "\x04card\x18\x01 \x01(\v2\x19.pasteferry.v1.FriendCardR\x04card\x12\x14\n" ++ "\x05reply\x18\x02 \x01(\bR\x05reply\"\r\n" +"\vRetryDirect\"n\n" +"\bSdpOffer\x12\x10\n" +"\x03sdp\x18\x01 \x01(\tR\x03sdp\x12)\n" +@@ -3613,7 +4180,7 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\apayload\";\n" +"\vServerError\x12\x12\n" +"\x04code\x18\x01 \x01(\tR\x04code\x12\x18\n" +- "\amessage\x18\x02 \x01(\tR\amessage\"\x98\x03\n" ++ "\amessage\x18\x02 \x01(\tR\amessage\"\xe3\x03\n" +"\tLanPacket\x12/\n" +"\x06signal\x18\x01 \x01(\v2\x15.pasteferry.v1.SignedH\x00R\x06signal\x12A\n" +"\fpair_request\x18\x02 \x01(\v2\x1c.pasteferry.v1.LanPairSignedH\x00R\vpairRequest\x12C\n" +@@ -3622,7 +4189,8 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"pairReject\x12E\n" +"\x0enearby_request\x18\x05 \x01(\v2\x1c.pasteferry.v1.LanPairSignedH\x00R\rnearbyRequest\x12?\n" +"\vnearby_ping\x18\x06 \x01(\v2\x1c.pasteferry.v1.LanNearbyPingH\x00R\n" +- "nearbyPingB\t\n" ++ "nearbyPing\x12I\n" ++ "\x10stranger_request\x18\a \x01(\v2\x1c.pasteferry.v1.LanPairSignedH\x00R\x0fstrangerRequestB\t\n" +"\apayload\"\x8a\x01\n" +"\bLanHello\x12\x1c\n" +"\taddresses\x18\x01 \x03(\tR\taddresses\x12!\n" +@@ -3631,7 +4199,7 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\x04boot\x18\x04 \x01(\fR\x04boot\"G\n" +"\rLanPairSigned\x12\x18\n" +"\apayload\x18\x01 \x01(\fR\apayload\x12\x1c\n" +- "\tsignature\x18\x02 \x01(\fR\tsignature\"\x9a\x02\n" ++ "\tsignature\x18\x02 \x01(\fR\tsignature\"\xe1\x02\n" +"\vLanPairInfo\x12\x12\n" +"\x04code\x18\x01 \x01(\tR\x04code\x12\x1b\n" +"\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12\x1f\n" +@@ -3643,7 +4211,10 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\taddresses\x18\x06 \x03(\tR\taddresses\x12%\n" +"\x0etimestamp_unix\x18\a \x01(\x03R\rtimestampUnix\x12\x14\n" +"\x05nonce\x18\b \x01(\fR\x05nonce\x12#\n" +- "\rrequest_nonce\x18\t \x01(\fR\frequestNonce\"L\n" ++ "\rrequest_nonce\x18\t \x01(\fR\frequestNonce\x12\x16\n" ++ "\x06intent\x18\n" ++ " \x01(\tR\x06intent\x12-\n" ++ "\x04card\x18\v \x01(\v2\x19.pasteferry.v1.FriendCardR\x04card\"L\n" +"\rLanPairReject\x12#\n" +"\rrequest_nonce\x18\x01 \x01(\fR\frequestNonce\x12\x16\n" +"\x06reason\x18\x02 \x01(\tR\x06reason\"q\n" +@@ -3651,7 +4222,7 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\binstance\x18\x01 \x01(\tR\binstance\x12\x12\n" +"\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" +"\bplatform\x18\x03 \x01(\tR\bplatform\x12\x14\n" +- "\x05token\x18\x04 \x01(\tR\x05token\"\xb5\x05\n" ++ "\x05token\x18\x04 \x01(\tR\x05token\"\xf8\x06\n" +"\vPeerMessage\x120\n" +"\x05offer\x18\x01 \x01(\v2\x18.pasteferry.v1.ClipOfferH\x00R\x05offer\x120\n" +"\x05fetch\x18\x02 \x01(\v2\x18.pasteferry.v1.PeerFetchH\x00R\x05fetch\x124\n" +@@ -3669,8 +4240,34 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\vsend_cancel\x18\v \x01(\v2\x19.pasteferry.v1.SendCancelH\x00R\n" +"sendCancel\x12<\n" +"\vsend_result\x18\f \x01(\v2\x19.pasteferry.v1.SendResultH\x00R\n" +- "sendResultB\t\n" +- "\apayload\"K\n" ++ "sendResult\x12<\n" ++ "\vfriend_card\x18\r \x01(\v2\x19.pasteferry.v1.FriendCardH\x00R\n" ++ "friendCard\x12E\n" ++ "\x0eavatar_request\x18\x0e \x01(\v2\x1c.pasteferry.v1.AvatarRequestH\x00R\ravatarRequest\x12<\n" ++ "\vavatar_data\x18\x0f \x01(\v2\x19.pasteferry.v1.AvatarDataH\x00R\n" ++ "avatarDataB\t\n" ++ "\apayload\"\xd5\x01\n" ++ "\n" ++ "FriendCard\x12!\n" ++ "\fdisplay_name\x18\x01 \x01(\tR\vdisplayName\x12\x1f\n" ++ "\vdevice_name\x18\x02 \x01(\tR\n" ++ "deviceName\x12\x1a\n" ++ "\bplatform\x18\x03 \x01(\tR\bplatform\x12\x18\n" ++ "\aservice\x18\x04 \x01(\tR\aservice\x12,\n" ++ "\x12custom_server_hash\x18\x05 \x01(\fR\x10customServerHash\x12\x1f\n" ++ "\vavatar_hash\x18\x06 \x01(\fR\n" ++ "avatarHash\"9\n" ++ "\fFriendRemove\x12\x17\n" ++ "\aat_unix\x18\x01 \x01(\x03R\x06atUnix\x12\x10\n" ++ "\x03ack\x18\x02 \x01(\bR\x03ack\"0\n" ++ "\rAvatarRequest\x12\x1f\n" ++ "\vavatar_hash\x18\x01 \x01(\fR\n" ++ "avatarHash\"A\n" ++ "\n" ++ "AvatarData\x12\x1f\n" ++ "\vavatar_hash\x18\x01 \x01(\fR\n" ++ "avatarHash\x12\x12\n" ++ "\x04jpeg\x18\x02 \x01(\fR\x04jpeg\"K\n" +"\fPeerFeatures\x12\x1a\n" +"\bfeatures\x18\x01 \x03(\tR\bfeatures\x12\x1f\n" +"\vapp_version\x18\x02 \x01(\tR\n" +@@ -3709,7 +4306,7 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"\tstream_id\x18\x02 \x01(\tR\bstreamId\x12\x0e\n" +"\x02ok\x18\x03 \x01(\bR\x02ok\x12\x14\n" +"\x05error\x18\x04 \x01(\tR\x05error\x12\x16\n" +- "\x06sha256\x18\x05 \x01(\fR\x06sha256\"\x98\x02\n" ++ "\x06sha256\x18\x05 \x01(\fR\x06sha256\"\xac\x02\n" +"\tSendOffer\x12\x1f\n" +"\vtransfer_id\x18\x01 \x01(\tR\n" +"transferId\x12\x18\n" +@@ -3721,7 +4318,8 @@ const file_pasteferry_v1_wire_proto_rawDesc = "" +"file_count\x18\x05 \x01(\x03R\tfileCount\x12!\n" +"\flargest_file\x18\x06 \x01(\x03R\vlargestFile\x12&\n" +"\x0fcreated_at_unix\x18\a \x01(\x03R\rcreatedAtUnix\x12\x16\n" +- "\x06resume\x18\b \x01(\bR\x06resume\"\x87\x02\n" ++ "\x06resume\x18\b \x01(\bR\x06resume\x12\x12\n" ++ "\x04note\x18\t \x01(\tR\x04note\"\x87\x02\n" +"\n" +"SendAnswer\x12\x1f\n" +"\vtransfer_id\x18\x01 \x01(\tR\n" +@@ -3787,108 +4385,126 @@ func file_pasteferry_v1_wire_proto_rawDescGZIP() []byte {}var file_pasteferry_v1_wire_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_pasteferry_v1_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 43)+var file_pasteferry_v1_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 50)var file_pasteferry_v1_wire_proto_goTypes = []any{(Compression)(0), // 0: pasteferry.v1.Compression(Packaging)(0), // 1: pasteferry.v1.Packaging(*Signed)(nil), // 2: pasteferry.v1.Signed(*SignalMessage)(nil), // 3: pasteferry.v1.SignalMessage- (*RetryDirect)(nil), // 4: pasteferry.v1.RetryDirect- (*SdpOffer)(nil), // 5: pasteferry.v1.SdpOffer- (*SdpAnswer)(nil), // 6: pasteferry.v1.SdpAnswer- (*IceCandidate)(nil), // 7: pasteferry.v1.IceCandidate- (*Ping)(nil), // 8: pasteferry.v1.Ping- (*ClientHello)(nil), // 9: pasteferry.v1.ClientHello- (*ServerHello)(nil), // 10: pasteferry.v1.ServerHello- (*IceServer)(nil), // 11: pasteferry.v1.IceServer- (*PeerPresence)(nil), // 12: pasteferry.v1.PeerPresence- (*PairingCreateRequest)(nil), // 13: pasteferry.v1.PairingCreateRequest- (*PairingCreateResponse)(nil), // 14: pasteferry.v1.PairingCreateResponse- (*PairingRedeemRequest)(nil), // 15: pasteferry.v1.PairingRedeemRequest- (*PairingRedeemResponse)(nil), // 16: pasteferry.v1.PairingRedeemResponse- (*PairingRedeemed)(nil), // 17: pasteferry.v1.PairingRedeemed- (*IceConfig)(nil), // 18: pasteferry.v1.IceConfig- (*ServerEnvelope)(nil), // 19: pasteferry.v1.ServerEnvelope- (*ClientEnvelope)(nil), // 20: pasteferry.v1.ClientEnvelope- (*ServerError)(nil), // 21: pasteferry.v1.ServerError- (*LanPacket)(nil), // 22: pasteferry.v1.LanPacket- (*LanHello)(nil), // 23: pasteferry.v1.LanHello- (*LanPairSigned)(nil), // 24: pasteferry.v1.LanPairSigned- (*LanPairInfo)(nil), // 25: pasteferry.v1.LanPairInfo- (*LanPairReject)(nil), // 26: pasteferry.v1.LanPairReject- (*LanNearbyPing)(nil), // 27: pasteferry.v1.LanNearbyPing- (*PeerMessage)(nil), // 28: pasteferry.v1.PeerMessage- (*PeerFeatures)(nil), // 29: pasteferry.v1.PeerFeatures- (*LinkInfo)(nil), // 30: pasteferry.v1.LinkInfo- (*PeerDisplay)(nil), // 31: pasteferry.v1.PeerDisplay- (*ClipOffer)(nil), // 32: pasteferry.v1.ClipOffer- (*PeerFetch)(nil), // 33: pasteferry.v1.PeerFetch- (*FetchReject)(nil), // 34: pasteferry.v1.FetchReject- (*TransferHeader)(nil), // 35: pasteferry.v1.TransferHeader- (*TransferDone)(nil), // 36: pasteferry.v1.TransferDone- (*SendOffer)(nil), // 37: pasteferry.v1.SendOffer- (*SendAnswer)(nil), // 38: pasteferry.v1.SendAnswer- (*SendCancel)(nil), // 39: pasteferry.v1.SendCancel- (*SendResult)(nil), // 40: pasteferry.v1.SendResult- (*SendFrame)(nil), // 41: pasteferry.v1.SendFrame- (*SendFileStart)(nil), // 42: pasteferry.v1.SendFileStart- (*SendFileEnd)(nil), // 43: pasteferry.v1.SendFileEnd- (*SendStreamEnd)(nil), // 44: pasteferry.v1.SendStreamEnd- (ClipKind)(0), // 45: pasteferry.v1.ClipKind- (*ClipItem)(nil), // 46: pasteferry.v1.ClipItem+ (*PairIntent)(nil), // 4: pasteferry.v1.PairIntent+ (*FriendConfirm)(nil), // 5: pasteferry.v1.FriendConfirm+ (*StrangerHello)(nil), // 6: pasteferry.v1.StrangerHello+ (*RetryDirect)(nil), // 7: pasteferry.v1.RetryDirect+ (*SdpOffer)(nil), // 8: pasteferry.v1.SdpOffer+ (*SdpAnswer)(nil), // 9: pasteferry.v1.SdpAnswer+ (*IceCandidate)(nil), // 10: pasteferry.v1.IceCandidate+ (*Ping)(nil), // 11: pasteferry.v1.Ping+ (*ClientHello)(nil), // 12: pasteferry.v1.ClientHello+ (*ServerHello)(nil), // 13: pasteferry.v1.ServerHello+ (*IceServer)(nil), // 14: pasteferry.v1.IceServer+ (*PeerPresence)(nil), // 15: pasteferry.v1.PeerPresence+ (*PairingCreateRequest)(nil), // 16: pasteferry.v1.PairingCreateRequest+ (*PairingCreateResponse)(nil), // 17: pasteferry.v1.PairingCreateResponse+ (*PairingRedeemRequest)(nil), // 18: pasteferry.v1.PairingRedeemRequest+ (*PairingRedeemResponse)(nil), // 19: pasteferry.v1.PairingRedeemResponse+ (*PairingRedeemed)(nil), // 20: pasteferry.v1.PairingRedeemed+ (*IceConfig)(nil), // 21: pasteferry.v1.IceConfig+ (*ServerEnvelope)(nil), // 22: pasteferry.v1.ServerEnvelope+ (*ClientEnvelope)(nil), // 23: pasteferry.v1.ClientEnvelope+ (*ServerError)(nil), // 24: pasteferry.v1.ServerError+ (*LanPacket)(nil), // 25: pasteferry.v1.LanPacket+ (*LanHello)(nil), // 26: pasteferry.v1.LanHello+ (*LanPairSigned)(nil), // 27: pasteferry.v1.LanPairSigned+ (*LanPairInfo)(nil), // 28: pasteferry.v1.LanPairInfo+ (*LanPairReject)(nil), // 29: pasteferry.v1.LanPairReject+ (*LanNearbyPing)(nil), // 30: pasteferry.v1.LanNearbyPing+ (*PeerMessage)(nil), // 31: pasteferry.v1.PeerMessage+ (*FriendCard)(nil), // 32: pasteferry.v1.FriendCard+ (*FriendRemove)(nil), // 33: pasteferry.v1.FriendRemove+ (*AvatarRequest)(nil), // 34: pasteferry.v1.AvatarRequest+ (*AvatarData)(nil), // 35: pasteferry.v1.AvatarData+ (*PeerFeatures)(nil), // 36: pasteferry.v1.PeerFeatures+ (*LinkInfo)(nil), // 37: pasteferry.v1.LinkInfo+ (*PeerDisplay)(nil), // 38: pasteferry.v1.PeerDisplay+ (*ClipOffer)(nil), // 39: pasteferry.v1.ClipOffer+ (*PeerFetch)(nil), // 40: pasteferry.v1.PeerFetch+ (*FetchReject)(nil), // 41: pasteferry.v1.FetchReject+ (*TransferHeader)(nil), // 42: pasteferry.v1.TransferHeader+ (*TransferDone)(nil), // 43: pasteferry.v1.TransferDone+ (*SendOffer)(nil), // 44: pasteferry.v1.SendOffer+ (*SendAnswer)(nil), // 45: pasteferry.v1.SendAnswer+ (*SendCancel)(nil), // 46: pasteferry.v1.SendCancel+ (*SendResult)(nil), // 47: pasteferry.v1.SendResult+ (*SendFrame)(nil), // 48: pasteferry.v1.SendFrame+ (*SendFileStart)(nil), // 49: pasteferry.v1.SendFileStart+ (*SendFileEnd)(nil), // 50: pasteferry.v1.SendFileEnd+ (*SendStreamEnd)(nil), // 51: pasteferry.v1.SendStreamEnd+ (ClipKind)(0), // 52: pasteferry.v1.ClipKind+ (*ClipItem)(nil), // 53: pasteferry.v1.ClipItem}var file_pasteferry_v1_wire_proto_depIdxs = []int32{- 5, // 0: pasteferry.v1.SignalMessage.offer:type_name -> pasteferry.v1.SdpOffer- 6, // 1: pasteferry.v1.SignalMessage.answer:type_name -> pasteferry.v1.SdpAnswer- 7, // 2: pasteferry.v1.SignalMessage.candidate:type_name -> pasteferry.v1.IceCandidate- 8, // 3: pasteferry.v1.SignalMessage.ping:type_name -> pasteferry.v1.Ping- 23, // 4: pasteferry.v1.SignalMessage.lan_hello:type_name -> pasteferry.v1.LanHello- 4, // 5: pasteferry.v1.SignalMessage.retry_direct:type_name -> pasteferry.v1.RetryDirect- 11, // 6: pasteferry.v1.ServerHello.ice_servers:type_name -> pasteferry.v1.IceServer- 11, // 7: pasteferry.v1.IceConfig.ice_servers:type_name -> pasteferry.v1.IceServer- 10, // 8: pasteferry.v1.ServerEnvelope.hello:type_name -> pasteferry.v1.ServerHello- 2, // 9: pasteferry.v1.ServerEnvelope.forwarded:type_name -> pasteferry.v1.Signed- 12, // 10: pasteferry.v1.ServerEnvelope.presence:type_name -> pasteferry.v1.PeerPresence- 14, // 11: pasteferry.v1.ServerEnvelope.pairing_created:type_name -> pasteferry.v1.PairingCreateResponse- 16, // 12: pasteferry.v1.ServerEnvelope.pairing_redeemed_result:type_name -> pasteferry.v1.PairingRedeemResponse- 17, // 13: pasteferry.v1.ServerEnvelope.pairing_redeemed:type_name -> pasteferry.v1.PairingRedeemed- 21, // 14: pasteferry.v1.ServerEnvelope.error:type_name -> pasteferry.v1.ServerError- 18, // 15: pasteferry.v1.ServerEnvelope.ice_config:type_name -> pasteferry.v1.IceConfig- 9, // 16: pasteferry.v1.ClientEnvelope.hello:type_name -> pasteferry.v1.ClientHello- 2, // 17: pasteferry.v1.ClientEnvelope.forward:type_name -> pasteferry.v1.Signed- 13, // 18: pasteferry.v1.ClientEnvelope.pairing_create:type_name -> pasteferry.v1.PairingCreateRequest- 15, // 19: pasteferry.v1.ClientEnvelope.pairing_redeem:type_name -> pasteferry.v1.PairingRedeemRequest- 2, // 20: pasteferry.v1.LanPacket.signal:type_name -> pasteferry.v1.Signed- 24, // 21: pasteferry.v1.LanPacket.pair_request:type_name -> pasteferry.v1.LanPairSigned- 24, // 22: pasteferry.v1.LanPacket.pair_response:type_name -> pasteferry.v1.LanPairSigned- 26, // 23: pasteferry.v1.LanPacket.pair_reject:type_name -> pasteferry.v1.LanPairReject- 24, // 24: pasteferry.v1.LanPacket.nearby_request:type_name -> pasteferry.v1.LanPairSigned- 27, // 25: pasteferry.v1.LanPacket.nearby_ping:type_name -> pasteferry.v1.LanNearbyPing- 32, // 26: pasteferry.v1.PeerMessage.offer:type_name -> pasteferry.v1.ClipOffer- 33, // 27: pasteferry.v1.PeerMessage.fetch:type_name -> pasteferry.v1.PeerFetch- 34, // 28: pasteferry.v1.PeerMessage.reject:type_name -> pasteferry.v1.FetchReject- 35, // 29: pasteferry.v1.PeerMessage.header:type_name -> pasteferry.v1.TransferHeader- 36, // 30: pasteferry.v1.PeerMessage.done:type_name -> pasteferry.v1.TransferDone- 30, // 31: pasteferry.v1.PeerMessage.link:type_name -> pasteferry.v1.LinkInfo- 31, // 32: pasteferry.v1.PeerMessage.display:type_name -> pasteferry.v1.PeerDisplay- 29, // 33: pasteferry.v1.PeerMessage.features:type_name -> pasteferry.v1.PeerFeatures- 37, // 34: pasteferry.v1.PeerMessage.send_offer:type_name -> pasteferry.v1.SendOffer- 38, // 35: pasteferry.v1.PeerMessage.send_answer:type_name -> pasteferry.v1.SendAnswer- 39, // 36: pasteferry.v1.PeerMessage.send_cancel:type_name -> pasteferry.v1.SendCancel- 40, // 37: pasteferry.v1.PeerMessage.send_result:type_name -> pasteferry.v1.SendResult- 45, // 38: pasteferry.v1.ClipOffer.kind:type_name -> pasteferry.v1.ClipKind- 46, // 39: pasteferry.v1.ClipOffer.items:type_name -> pasteferry.v1.ClipItem- 0, // 40: pasteferry.v1.TransferHeader.compression:type_name -> pasteferry.v1.Compression- 1, // 41: pasteferry.v1.TransferHeader.packaging:type_name -> pasteferry.v1.Packaging- 46, // 42: pasteferry.v1.SendOffer.items:type_name -> pasteferry.v1.ClipItem- 42, // 43: pasteferry.v1.SendFrame.file:type_name -> pasteferry.v1.SendFileStart- 43, // 44: pasteferry.v1.SendFrame.file_end:type_name -> pasteferry.v1.SendFileEnd- 44, // 45: pasteferry.v1.SendFrame.end:type_name -> pasteferry.v1.SendStreamEnd- 46, // [46:46] is the sub-list for method output_type- 46, // [46:46] is the sub-list for method input_type- 46, // [46:46] is the sub-list for extension type_name- 46, // [46:46] is the sub-list for extension extendee- 0, // [0:46] is the sub-list for field type_name+ 8, // 0: pasteferry.v1.SignalMessage.offer:type_name -> pasteferry.v1.SdpOffer+ 9, // 1: pasteferry.v1.SignalMessage.answer:type_name -> pasteferry.v1.SdpAnswer+ 10, // 2: pasteferry.v1.SignalMessage.candidate:type_name -> pasteferry.v1.IceCandidate+ 11, // 3: pasteferry.v1.SignalMessage.ping:type_name -> pasteferry.v1.Ping+ 26, // 4: pasteferry.v1.SignalMessage.lan_hello:type_name -> pasteferry.v1.LanHello+ 7, // 5: pasteferry.v1.SignalMessage.retry_direct:type_name -> pasteferry.v1.RetryDirect+ 4, // 6: pasteferry.v1.SignalMessage.pair_intent:type_name -> pasteferry.v1.PairIntent+ 5, // 7: pasteferry.v1.SignalMessage.friend_confirm:type_name -> pasteferry.v1.FriendConfirm+ 6, // 8: pasteferry.v1.SignalMessage.stranger_hello:type_name -> pasteferry.v1.StrangerHello+ 33, // 9: pasteferry.v1.SignalMessage.friend_remove:type_name -> pasteferry.v1.FriendRemove+ 32, // 10: pasteferry.v1.PairIntent.card:type_name -> pasteferry.v1.FriendCard+ 32, // 11: pasteferry.v1.StrangerHello.card:type_name -> pasteferry.v1.FriendCard+ 14, // 12: pasteferry.v1.ServerHello.ice_servers:type_name -> pasteferry.v1.IceServer+ 14, // 13: pasteferry.v1.IceConfig.ice_servers:type_name -> pasteferry.v1.IceServer+ 13, // 14: pasteferry.v1.ServerEnvelope.hello:type_name -> pasteferry.v1.ServerHello+ 2, // 15: pasteferry.v1.ServerEnvelope.forwarded:type_name -> pasteferry.v1.Signed+ 15, // 16: pasteferry.v1.ServerEnvelope.presence:type_name -> pasteferry.v1.PeerPresence+ 17, // 17: pasteferry.v1.ServerEnvelope.pairing_created:type_name -> pasteferry.v1.PairingCreateResponse+ 19, // 18: pasteferry.v1.ServerEnvelope.pairing_redeemed_result:type_name -> pasteferry.v1.PairingRedeemResponse+ 20, // 19: pasteferry.v1.ServerEnvelope.pairing_redeemed:type_name -> pasteferry.v1.PairingRedeemed+ 24, // 20: pasteferry.v1.ServerEnvelope.error:type_name -> pasteferry.v1.ServerError+ 21, // 21: pasteferry.v1.ServerEnvelope.ice_config:type_name -> pasteferry.v1.IceConfig+ 12, // 22: pasteferry.v1.ClientEnvelope.hello:type_name -> pasteferry.v1.ClientHello+ 2, // 23: pasteferry.v1.ClientEnvelope.forward:type_name -> pasteferry.v1.Signed+ 16, // 24: pasteferry.v1.ClientEnvelope.pairing_create:type_name -> pasteferry.v1.PairingCreateRequest+ 18, // 25: pasteferry.v1.ClientEnvelope.pairing_redeem:type_name -> pasteferry.v1.PairingRedeemRequest+ 2, // 26: pasteferry.v1.LanPacket.signal:type_name -> pasteferry.v1.Signed+ 27, // 27: pasteferry.v1.LanPacket.pair_request:type_name -> pasteferry.v1.LanPairSigned+ 27, // 28: pasteferry.v1.LanPacket.pair_response:type_name -> pasteferry.v1.LanPairSigned+ 29, // 29: pasteferry.v1.LanPacket.pair_reject:type_name -> pasteferry.v1.LanPairReject+ 27, // 30: pasteferry.v1.LanPacket.nearby_request:type_name -> pasteferry.v1.LanPairSigned+ 30, // 31: pasteferry.v1.LanPacket.nearby_ping:type_name -> pasteferry.v1.LanNearbyPing+ 27, // 32: pasteferry.v1.LanPacket.stranger_request:type_name -> pasteferry.v1.LanPairSigned+ 32, // 33: pasteferry.v1.LanPairInfo.card:type_name -> pasteferry.v1.FriendCard+ 39, // 34: pasteferry.v1.PeerMessage.offer:type_name -> pasteferry.v1.ClipOffer+ 40, // 35: pasteferry.v1.PeerMessage.fetch:type_name -> pasteferry.v1.PeerFetch+ 41, // 36: pasteferry.v1.PeerMessage.reject:type_name -> pasteferry.v1.FetchReject+ 42, // 37: pasteferry.v1.PeerMessage.header:type_name -> pasteferry.v1.TransferHeader+ 43, // 38: pasteferry.v1.PeerMessage.done:type_name -> pasteferry.v1.TransferDone+ 37, // 39: pasteferry.v1.PeerMessage.link:type_name -> pasteferry.v1.LinkInfo+ 38, // 40: pasteferry.v1.PeerMessage.display:type_name -> pasteferry.v1.PeerDisplay+ 36, // 41: pasteferry.v1.PeerMessage.features:type_name -> pasteferry.v1.PeerFeatures+ 44, // 42: pasteferry.v1.PeerMessage.send_offer:type_name -> pasteferry.v1.SendOffer+ 45, // 43: pasteferry.v1.PeerMessage.send_answer:type_name -> pasteferry.v1.SendAnswer+ 46, // 44: pasteferry.v1.PeerMessage.send_cancel:type_name -> pasteferry.v1.SendCancel+ 47, // 45: pasteferry.v1.PeerMessage.send_result:type_name -> pasteferry.v1.SendResult+ 32, // 46: pasteferry.v1.PeerMessage.friend_card:type_name -> pasteferry.v1.FriendCard+ 34, // 47: pasteferry.v1.PeerMessage.avatar_request:type_name -> pasteferry.v1.AvatarRequest+ 35, // 48: pasteferry.v1.PeerMessage.avatar_data:type_name -> pasteferry.v1.AvatarData+ 52, // 49: pasteferry.v1.ClipOffer.kind:type_name -> pasteferry.v1.ClipKind+ 53, // 50: pasteferry.v1.ClipOffer.items:type_name -> pasteferry.v1.ClipItem+ 0, // 51: pasteferry.v1.TransferHeader.compression:type_name -> pasteferry.v1.Compression+ 1, // 52: pasteferry.v1.TransferHeader.packaging:type_name -> pasteferry.v1.Packaging+ 53, // 53: pasteferry.v1.SendOffer.items:type_name -> pasteferry.v1.ClipItem+ 49, // 54: pasteferry.v1.SendFrame.file:type_name -> pasteferry.v1.SendFileStart+ 50, // 55: pasteferry.v1.SendFrame.file_end:type_name -> pasteferry.v1.SendFileEnd+ 51, // 56: pasteferry.v1.SendFrame.end:type_name -> pasteferry.v1.SendStreamEnd+ 57, // [57:57] is the sub-list for method output_type+ 57, // [57:57] is the sub-list for method input_type+ 57, // [57:57] is the sub-list for extension type_name+ 57, // [57:57] is the sub-list for extension extendee+ 0, // [0:57] is the sub-list for field type_name}func init() { file_pasteferry_v1_wire_proto_init() }@@ -3904,8 +4520,12 @@ func file_pasteferry_v1_wire_proto_init() {(*SignalMessage_Ping)(nil),(*SignalMessage_LanHello)(nil),(*SignalMessage_RetryDirect)(nil),+ (*SignalMessage_PairIntent)(nil),+ (*SignalMessage_FriendConfirm)(nil),+ (*SignalMessage_StrangerHello)(nil),+ (*SignalMessage_FriendRemove)(nil),}- file_pasteferry_v1_wire_proto_msgTypes[17].OneofWrappers = []any{+ file_pasteferry_v1_wire_proto_msgTypes[20].OneofWrappers = []any{(*ServerEnvelope_Hello)(nil),(*ServerEnvelope_Forwarded)(nil),(*ServerEnvelope_Presence)(nil),@@ -3915,21 +4535,22 @@ func file_pasteferry_v1_wire_proto_init() {(*ServerEnvelope_Error)(nil),(*ServerEnvelope_IceConfig)(nil),}- file_pasteferry_v1_wire_proto_msgTypes[18].OneofWrappers = []any{+ file_pasteferry_v1_wire_proto_msgTypes[21].OneofWrappers = []any{(*ClientEnvelope_Hello)(nil),(*ClientEnvelope_Forward)(nil),(*ClientEnvelope_PairingCreate)(nil),(*ClientEnvelope_PairingRedeem)(nil),}- file_pasteferry_v1_wire_proto_msgTypes[20].OneofWrappers = []any{+ file_pasteferry_v1_wire_proto_msgTypes[23].OneofWrappers = []any{(*LanPacket_Signal)(nil),(*LanPacket_PairRequest)(nil),(*LanPacket_PairResponse)(nil),(*LanPacket_PairReject)(nil),(*LanPacket_NearbyRequest)(nil),(*LanPacket_NearbyPing)(nil),+ (*LanPacket_StrangerRequest)(nil),}- file_pasteferry_v1_wire_proto_msgTypes[26].OneofWrappers = []any{+ file_pasteferry_v1_wire_proto_msgTypes[29].OneofWrappers = []any{(*PeerMessage_Offer)(nil),(*PeerMessage_Fetch)(nil),(*PeerMessage_Reject)(nil),@@ -3942,8 +4563,11 @@ func file_pasteferry_v1_wire_proto_init() {(*PeerMessage_SendAnswer)(nil),(*PeerMessage_SendCancel)(nil),(*PeerMessage_SendResult)(nil),+ (*PeerMessage_FriendCard)(nil),+ (*PeerMessage_AvatarRequest)(nil),+ (*PeerMessage_AvatarData)(nil),}- file_pasteferry_v1_wire_proto_msgTypes[39].OneofWrappers = []any{+ file_pasteferry_v1_wire_proto_msgTypes[46].OneofWrappers = []any{(*SendFrame_File)(nil),(*SendFrame_FileEnd)(nil),(*SendFrame_End)(nil),@@ -3954,7 +4578,7 @@ func file_pasteferry_v1_wire_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_pasteferry_v1_wire_proto_rawDesc), len(file_pasteferry_v1_wire_proto_rawDesc)),NumEnums: 2,- NumMessages: 43,+ NumMessages: 50,NumExtensions: 0,NumServices: 0,},diff --git a/proto/pasteferry/v1/daemon.proto b/proto/pasteferry/v1/daemon.protoindex 9e2a52f..da71d43 100644--- a/proto/pasteferry/v1/daemon.proto+++ b/proto/pasteferry/v1/daemon.proto@@ -105,6 +105,29 @@ service DaemonService {// 检查保存位置能否写入。path 为空时检查当前设置的位置。// 在 macOS 上会在这时触发系统的文件夹授权弹窗,所以要在用户看着界面时调用rpc CheckReceiveDir(CheckReceiveDirRequest) returns (CheckReceiveDirResponse);+ // 别人发来的、在等用户接受的一批:接受或拒绝。always 表示以后自动接收这个好友的文件+ rpc AnswerIncoming(AnswerIncomingRequest) returns (Empty);++ // ── 好友,见 design/friends-send.md ──+ rpc GetProfile(Empty) returns (Profile);+ rpc SetDisplayName(SetDisplayNameRequest) returns (Profile);+ // 设置头像:图片文件或剪贴板里的图片,按裁剪区域裁成正方形,处理成 256×256 的 JPEG+ rpc SetAvatar(SetAvatarRequest) returns (Profile);+ rpc ResetAvatar(Empty) returns (Profile);+ // 本机或某个好友的头像(JPEG)。没有自定义头像时为空+ rpc GetAvatar(GetAvatarRequest) returns (Avatar);+ // 生成好友码(F 加 6 位),5 分钟有效。别人兑换后推送 friend_request 事件+ rpc CreateFriendCode(Empty) returns (CreatePairingCodeResponse);+ // 输入好友码,返回对方的名片和会话;用户在确认框里点了以后调 ConfirmFriend+ rpc RedeemFriendCode(RedeemPairingCodeRequest) returns (FriendRequest);+ rpc ConfirmFriend(ConfirmPairingRequest) returns (Empty);+ rpc ListFriends(Empty) returns (ListFriendsResponse);+ rpc RemoveFriend(FriendRef) returns (Empty);+ rpc SetFriendAutoAccept(SetFriendAutoAcceptRequest) returns (Friend);+ // 「所有人」模式下拒绝过的陌生设备,以后它的请求直接拒绝+ rpc BlockDevice(FriendRef) returns (Empty);+ // 隔空传送页打开期间保持这个调用:推送附近开着「所有人」的陌生设备(只在局域网里)+ rpc WatchStrangers(Empty) returns (stream Strangers);}message Empty {}@@ -244,9 +267,112 @@ message Event {// 让界面切到某一页:"send" 是隔空传送页(用户点了隔空传送的通知)。// 界面是被这次点击拉起来的话还没订阅,后台服务在它订阅时补发最近 15 秒内的这一条string navigate = 13;+ // 好友(2.6.0)+ Friend friend_changed = 14;+ string friend_removed = 15; // device id+ // 有人兑换了本机的好友码,界面弹出确认框+ FriendRequest friend_request = 16;+ Profile profile_changed = 17;}}+// ─────────────────────────── 好友 ───────────────────────────++message Profile {+ string display_name = 1; // 实际用的名字(没设置时是系统的用户全名)+ string device_id = 2;+ bool has_avatar = 3;+ bytes avatar_hash = 4;+}++message SetDisplayNameRequest {+ string name = 1; // 空字符串表示恢复成系统的用户全名+}++message SetAvatarRequest {+ string path = 1; // 图片文件;为空时用剪贴板里的图片+ bytes image = 5; // 直接给图片数据(界面里粘贴、拖入时)+ // 裁剪区域,按原图的比例(0 到 1);都为 0 时取中间最大的正方形+ double crop_x = 2;+ double crop_y = 3;+ double crop_size = 4;+}++message GetAvatarRequest {+ string device_id = 1; // 空表示本机+}++message Avatar {+ bytes jpeg = 1;+ bytes avatar_hash = 2;+}++message FriendRef {+ string device_id = 1;+}++message SetFriendAutoAcceptRequest {+ string device_id = 1;+ bool auto_accept = 2;+}++// 好友就是对方的一台电脑+message Friend {+ string id = 1;+ string display_name = 2;+ string device_name = 3;+ string platform = 4;+ bool online = 5;+ ConnectionKind connection = 6;+ bool lan_reachable = 7;+ // 与 Device 相同:已经知道对方支持哪些功能+ bool features_known = 8;+ // 对方能接收好友发来的文件(声明了 send_files_ask_v1 且没有选「均不允许」)+ bool receives_files = 9;+ // 对方选了「均不允许」+ bool receive_disabled = 10;+ string app_version = 11;+ bool auto_accept = 12;+ int64 added_at_unix = 13;+ int64 last_activity_unix = 14;+ // 连不上的原因,见 design/friends-send.md 第 9.2 节:+ // ""(不用提示)、"self_no_service"(本机没开服务)、"peer_no_service"(对方没开服务)、+ // "different_server"(两边用的不是同一台服务器)+ string reachability = 15;+ bool has_avatar = 16;+ bytes avatar_hash = 17;+ string fingerprint = 18;+}++message ListFriendsResponse {+ repeated Friend friends = 1;+}++// 加好友时等待用户确认的对方信息+message FriendRequest {+ string session = 1;+ string device_id = 2;+ string display_name = 3;+ string device_name = 4;+ string platform = 5;+ // 两边的安全指纹,面对面时可以核对+ string fingerprint = 6;+ string self_fingerprint = 7;+}++// 附近开着「所有人」的陌生设备+message Stranger {+ string id = 1;+ string display_name = 2;+ string device_name = 3;+ string platform = 4;+ bool receives_files = 5;+}++message Strangers {+ repeated Stranger strangers = 1;+}+message NotificationStatus {bool supported = 1;bool actions_supported = 2;@@ -493,6 +619,13 @@ message Config {bool realtime_sync_disabled = 27;bool sync_backlog = 28;repeated string sync_disabled_peers = 29;+ // 谁可以给我发文件(2.6.0):"off"(均不允许)、"friends"(仅限好友,默认)、"everyone"(所有人)。+ // 只管别人;自己设备之间的发送看 receive_disabled+ string receive_from = 30;+ // 「所有人」在这个时间自动回到「仅限好友」,Unix 秒。打开「所有人」时由后台服务填上+ int64 everyone_until_unix = 31;+ // 好友看到的名字,空表示系统的用户全名+ string display_name = 32;}enum ServiceMode {@@ -661,6 +794,8 @@ message SendFilesRequest {repeated string paths = 2;// 用户已确认可以经官方服务中转bool allow_relay = 3;+ // 备注,见 Transfer.note+ string note = 4;}message TransferRef {@@ -689,6 +824,7 @@ message Transfer {int64 file_count = 10;double bytes_per_second = 11;// 失败、回绝、取消的原因,固定代码,界面翻译:no_space、dest_unavailable、+ // declined(对方拒绝)、timeout(对方没有回应)、not_allowed(对方不接收)、// file_too_large、disabled、unsupported、offline、source_changed、source_missing、// read_error、write_failed、hash_mismatch、cancelled、peer_cancelled、relay_quota 等string error = 12;@@ -705,6 +841,19 @@ message Transfer {// 收到的:文件名里有本机文件系统不允许的字符、改过名的文件数。只有 Windows 上会有:// : * ? " < > | \ 换成相近的全角字符,见 pack/names.go。文件内容不受影响int64 renamed_files = 22;+ // 对方是谁(2.6.0):"self"(自己的设备)、"friend"、"stranger"(「所有人」模式下的陌生设备)+ string peer_role = 23;+ // 备注+ string note = 24;+ // 收到的图片的缩略图(本机重新编码过的 PNG),与 items 一一对应,不是图片的为空+ repeated string thumbs = 25;+}++message AnswerIncomingRequest {+ string transfer_id = 1;+ bool accept = 2;+ // 以后自动接收这个好友的文件(陌生设备忽略)+ bool always = 3;}message ListTransfersRequest {diff --git a/proto/pasteferry/v1/wire.proto b/proto/pasteferry/v1/wire.protoindex 0ebb82c..fcab065 100644--- a/proto/pasteferry/v1/wire.proto+++ b/proto/pasteferry/v1/wire.proto@@ -44,9 +44,35 @@ message SignalMessage {Ping ping = 13;LanHello lan_hello = 14; // 只走局域网,见下文RetryDirect retry_direct = 15;+ // 配对码兑换后、用户确认前,两边告诉对方这次是配对还是加好友(2.6.0)。+ // 旧版本不发:没收到就当作配对+ PairIntent pair_intent = 16;+ // 加好友:本端的用户点了「添加」或「取消」。两边都添加了才算好友+ FriendConfirm friend_confirm = 17;+ // 「所有人」模式下陌生设备之间交换的名片,见 design/friends-send.md 第 9.1 节+ StrangerHello stranger_hello = 18;+ FriendRemove friend_remove = 19;}}+// 配对码兑换后各自发一次,直到收到对方的。intent 是 "device"(配对)或 "friend"(加好友)+message PairIntent {+ string intent = 1;+ // 加好友时带上名片,确认框里显示对方的名字+ FriendCard card = 2;+}++message FriendConfirm {+ bool accepted = 1;+}++// 「所有人」模式:发送方先发,接收方开着「所有人」时回一条(reply = true)。+// 公钥随签名的局域网配对信息交换(见 LanPacket.stranger),这里只带显示用的名片+message StrangerHello {+ FriendCard card = 1;+ bool reply = 2;+}+// 用户在应答方点了「重新连接」:只有发起方能做 ICE 重启,请它马上再试一次直连。// 旧版本不认识它,照旧按自己的间隔重试message RetryDirect {}@@ -200,6 +226,9 @@ message LanPacket {LanPairReject pair_reject = 4;LanPairSigned nearby_request = 5;LanNearbyPing nearby_ping = 6;+ // 「所有人」模式(2.6.0):向开着「所有人」的陌生设备要它的公钥,以便给它发文件。+ // 请求与回复都带名片(LanPairInfo.card),不带配对码+ LanPairSigned stranger_request = 7;}}@@ -230,6 +259,11 @@ message LanPairInfo {int64 timestamp_unix = 7;bytes nonce = 8;bytes request_nonce = 9; // 回复里回显请求的 nonce,把回复绑定到这次请求+ // 这次是配对("device",旧版本不带)还是加好友("friend",2.6.0)。+ // 显示码的一方发现与自己开放的不一致时回绝(intent_device / intent_friend),不用掉这个码+ string intent = 10;+ // 加好友时带上名片+ FriendCard card = 11;}message LanPairReject {@@ -264,9 +298,42 @@ message PeerMessage {SendAnswer send_answer = 10;SendCancel send_cancel = 11;SendResult send_result = 12;+ // 好友(2.6.0):连上后各自发一次名片;名片里的头像哈希变了才要头像+ FriendCard friend_card = 13;+ AvatarRequest avatar_request = 14;+ AvatarData avatar_data = 15;}}+// 好友看到的本机信息。只在加密通道里、发给好友或陌生设备+message FriendCard {+ string display_name = 1;+ string device_name = 2;+ string platform = 3;+ // 本机用的是哪种服务:official / custom / lan,判断两边能不能跨网络找到对方+ string service = 4;+ // 自建服务器地址的哈希(SHA-256 的前 16 字节),判断是不是同一台;不带地址本身+ bytes custom_server_hash = 5;+ // 头像的哈希,空表示用默认头像+ bytes avatar_hash = 6;+}++// 删除好友。走签名的信令(不用先建 P2P 连接);收到的一方删掉后回一条 ack = true,+// 发出的一方收到回执才不再补发+message FriendRemove {+ int64 at_unix = 1;+ bool ack = 2;+}++message AvatarRequest {+ bytes avatar_hash = 1;+}++message AvatarData {+ bytes avatar_hash = 1;+ bytes jpeg = 2; // 最大 64 KB+}+// 连接就绪后各自发一次,与 LinkInfo 一起;功能开关变了再发一次。// 旧版本不发,也不认识它,对方据此当作不支持。message PeerFeatures {@@ -366,6 +433,8 @@ message SendOffer {int64 created_at_unix = 7;// 续传:同一个 transfer_id 再次发起bool resume = 8;+ // 备注(2.6.0):最多 200 个字符、单行,必须附在文件上+ string note = 9;}message SendAnswer {diff --git a/ui/lib/gen/pasteferry/v1/daemon.pb.dart b/ui/lib/gen/pasteferry/v1/daemon.pb.dartindex 898d0ca..a7ac5fd 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pb.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pb.dart@@ -788,6 +788,10 @@ enum Event_Payload {transferChanged,transferRemoved,navigate,+ friendChanged,+ friendRemoved,+ friendRequest,+ profileChanged,notSet}@@ -806,6 +810,10 @@ class Event extends $pb.GeneratedMessage {Transfer? transferChanged,$core.String? transferRemoved,$core.String? navigate,+ Friend? friendChanged,+ $core.String? friendRemoved,+ FriendRequest? friendRequest,+ Profile? profileChanged,}) {final result = Event._();if (clipAdded != null) result.clipAdded = clipAdded;@@ -821,6 +829,10 @@ class Event extends $pb.GeneratedMessage {if (transferChanged != null) result.transferChanged = transferChanged;if (transferRemoved != null) result.transferRemoved = transferRemoved;if (navigate != null) result.navigate = navigate;+ if (friendChanged != null) result.friendChanged = friendChanged;+ if (friendRemoved != null) result.friendRemoved = friendRemoved;+ if (friendRequest != null) result.friendRequest = friendRequest;+ if (profileChanged != null) result.profileChanged = profileChanged;return result;}@@ -847,13 +859,17 @@ class Event extends $pb.GeneratedMessage {11: Event_Payload.transferChanged,12: Event_Payload.transferRemoved,13: Event_Payload.navigate,+ 14: Event_Payload.friendChanged,+ 15: Event_Payload.friendRemoved,+ 16: Event_Payload.friendRequest,+ 17: Event_Payload.profileChanged,0: Event_Payload.notSet};static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Event',package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),createEmptyInstance: Event.$_createMessage)- ..oo(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])+ ..oo(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17])..aOM<ClipRecord>(1, _omitFieldNames ? '' : 'clipAdded',subBuilder: ClipRecord.$_createMessage)..aOM<ClipRecord>(2, _omitFieldNames ? '' : 'clipUpdated',@@ -877,6 +893,13 @@ class Event extends $pb.GeneratedMessage {subBuilder: Transfer.$_createMessage)..aOS(12, _omitFieldNames ? '' : 'transferRemoved')..aOS(13, _omitFieldNames ? '' : 'navigate')+ ..aOM<Friend>(14, _omitFieldNames ? '' : 'friendChanged',+ subBuilder: Friend.$_createMessage)+ ..aOS(15, _omitFieldNames ? '' : 'friendRemoved')+ ..aOM<FriendRequest>(16, _omitFieldNames ? '' : 'friendRequest',+ subBuilder: FriendRequest.$_createMessage)+ ..aOM<Profile>(17, _omitFieldNames ? '' : 'profileChanged',+ subBuilder: Profile.$_createMessage)..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -912,6 +935,10 @@ class Event extends $pb.GeneratedMessage {@$pb.TagNumber(11)@$pb.TagNumber(12)@$pb.TagNumber(13)+ @$pb.TagNumber(14)+ @$pb.TagNumber(15)+ @$pb.TagNumber(16)+ @$pb.TagNumber(17)Event_Payload whichPayload() => _Event_PayloadByTag[$_whichOneof(0)]!;@$pb.TagNumber(1)@$pb.TagNumber(2)@@ -926,146 +953,1313 @@ class Event extends $pb.GeneratedMessage {@$pb.TagNumber(11)@$pb.TagNumber(12)@$pb.TagNumber(13)+ @$pb.TagNumber(14)+ @$pb.TagNumber(15)+ @$pb.TagNumber(16)+ @$pb.TagNumber(17)void clearPayload() => $_clearField($_whichOneof(0));@$pb.TagNumber(1)- ClipRecord get clipAdded => $_getN(0);- @$pb.TagNumber(1)- set clipAdded(ClipRecord value) => $_setField(1, value);+ ClipRecord get clipAdded => $_getN(0);+ @$pb.TagNumber(1)+ set clipAdded(ClipRecord value) => $_setField(1, value);+ @$pb.TagNumber(1)+ $core.bool hasClipAdded() => $_has(0);+ @$pb.TagNumber(1)+ void clearClipAdded() => $_clearField(1);+ @$pb.TagNumber(1)+ ClipRecord ensureClipAdded() => $_ensure(0);++ @$pb.TagNumber(2)+ ClipRecord get clipUpdated => $_getN(1);+ @$pb.TagNumber(2)+ set clipUpdated(ClipRecord value) => $_setField(2, value);+ @$pb.TagNumber(2)+ $core.bool hasClipUpdated() => $_has(1);+ @$pb.TagNumber(2)+ void clearClipUpdated() => $_clearField(2);+ @$pb.TagNumber(2)+ ClipRecord ensureClipUpdated() => $_ensure(1);++ @$pb.TagNumber(3)+ $core.String get clipRemoved => $_getSZ(2);+ @$pb.TagNumber(3)+ set clipRemoved($core.String value) => $_setString(2, value);+ @$pb.TagNumber(3)+ $core.bool hasClipRemoved() => $_has(2);+ @$pb.TagNumber(3)+ void clearClipRemoved() => $_clearField(3);++ @$pb.TagNumber(4)+ TransferProgress get progress => $_getN(3);+ @$pb.TagNumber(4)+ set progress(TransferProgress value) => $_setField(4, value);+ @$pb.TagNumber(4)+ $core.bool hasProgress() => $_has(3);+ @$pb.TagNumber(4)+ void clearProgress() => $_clearField(4);+ @$pb.TagNumber(4)+ TransferProgress ensureProgress() => $_ensure(3);++ @$pb.TagNumber(5)+ Device get deviceChanged => $_getN(4);+ @$pb.TagNumber(5)+ set deviceChanged(Device value) => $_setField(5, value);+ @$pb.TagNumber(5)+ $core.bool hasDeviceChanged() => $_has(4);+ @$pb.TagNumber(5)+ void clearDeviceChanged() => $_clearField(5);+ @$pb.TagNumber(5)+ Device ensureDeviceChanged() => $_ensure(4);++ @$pb.TagNumber(6)+ ClipboardPermission get permissionChanged => $_getN(5);+ @$pb.TagNumber(6)+ set permissionChanged(ClipboardPermission value) => $_setField(6, value);+ @$pb.TagNumber(6)+ $core.bool hasPermissionChanged() => $_has(5);+ @$pb.TagNumber(6)+ void clearPermissionChanged() => $_clearField(6);++ @$pb.TagNumber(7)+ Status get statusChanged => $_getN(6);+ @$pb.TagNumber(7)+ set statusChanged(Status value) => $_setField(7, value);+ @$pb.TagNumber(7)+ $core.bool hasStatusChanged() => $_has(6);+ @$pb.TagNumber(7)+ void clearStatusChanged() => $_clearField(7);+ @$pb.TagNumber(7)+ Status ensureStatusChanged() => $_ensure(6);++ @$pb.TagNumber(8)+ ClipboardWriteResult get clipboardWritten => $_getN(7);+ @$pb.TagNumber(8)+ set clipboardWritten(ClipboardWriteResult value) => $_setField(8, value);+ @$pb.TagNumber(8)+ $core.bool hasClipboardWritten() => $_has(7);+ @$pb.TagNumber(8)+ void clearClipboardWritten() => $_clearField(8);+ @$pb.TagNumber(8)+ ClipboardWriteResult ensureClipboardWritten() => $_ensure(7);++ /// 设置保存后推送,快捷窗口据此重新注册快捷键+ @$pb.TagNumber(9)+ Config get configChanged => $_getN(8);+ @$pb.TagNumber(9)+ set configChanged(Config value) => $_setField(9, value);+ @$pb.TagNumber(9)+ $core.bool hasConfigChanged() => $_has(8);+ @$pb.TagNumber(9)+ void clearConfigChanged() => $_clearField(9);+ @$pb.TagNumber(9)+ Config ensureConfigChanged() => $_ensure(8);++ @$pb.TagNumber(10)+ QuickPasteStatus get quickPasteChanged => $_getN(9);+ @$pb.TagNumber(10)+ set quickPasteChanged(QuickPasteStatus value) => $_setField(10, value);+ @$pb.TagNumber(10)+ $core.bool hasQuickPasteChanged() => $_has(9);+ @$pb.TagNumber(10)+ void clearQuickPasteChanged() => $_clearField(10);+ @$pb.TagNumber(10)+ QuickPasteStatus ensureQuickPasteChanged() => $_ensure(9);++ /// 隔空传送的一批新建、状态变化或进度更新(进度 0.2 秒节流)+ @$pb.TagNumber(11)+ Transfer get transferChanged => $_getN(10);+ @$pb.TagNumber(11)+ set transferChanged(Transfer value) => $_setField(11, value);+ @$pb.TagNumber(11)+ $core.bool hasTransferChanged() => $_has(10);+ @$pb.TagNumber(11)+ void clearTransferChanged() => $_clearField(11);+ @$pb.TagNumber(11)+ Transfer ensureTransferChanged() => $_ensure(10);++ @$pb.TagNumber(12)+ $core.String get transferRemoved => $_getSZ(11);+ @$pb.TagNumber(12)+ set transferRemoved($core.String value) => $_setString(11, value);+ @$pb.TagNumber(12)+ $core.bool hasTransferRemoved() => $_has(11);+ @$pb.TagNumber(12)+ void clearTransferRemoved() => $_clearField(12);++ /// 让界面切到某一页:"send" 是隔空传送页(用户点了隔空传送的通知)。+ /// 界面是被这次点击拉起来的话还没订阅,后台服务在它订阅时补发最近 15 秒内的这一条+ @$pb.TagNumber(13)+ $core.String get navigate => $_getSZ(12);+ @$pb.TagNumber(13)+ set navigate($core.String value) => $_setString(12, value);+ @$pb.TagNumber(13)+ $core.bool hasNavigate() => $_has(12);+ @$pb.TagNumber(13)+ void clearNavigate() => $_clearField(13);++ /// 好友(2.6.0)+ @$pb.TagNumber(14)+ Friend get friendChanged => $_getN(13);+ @$pb.TagNumber(14)+ set friendChanged(Friend value) => $_setField(14, value);+ @$pb.TagNumber(14)+ $core.bool hasFriendChanged() => $_has(13);+ @$pb.TagNumber(14)+ void clearFriendChanged() => $_clearField(14);+ @$pb.TagNumber(14)+ Friend ensureFriendChanged() => $_ensure(13);++ @$pb.TagNumber(15)+ $core.String get friendRemoved => $_getSZ(14);+ @$pb.TagNumber(15)+ set friendRemoved($core.String value) => $_setString(14, value);+ @$pb.TagNumber(15)+ $core.bool hasFriendRemoved() => $_has(14);+ @$pb.TagNumber(15)+ void clearFriendRemoved() => $_clearField(15);++ /// 有人兑换了本机的好友码,界面弹出确认框+ @$pb.TagNumber(16)+ FriendRequest get friendRequest => $_getN(15);+ @$pb.TagNumber(16)+ set friendRequest(FriendRequest value) => $_setField(16, value);+ @$pb.TagNumber(16)+ $core.bool hasFriendRequest() => $_has(15);+ @$pb.TagNumber(16)+ void clearFriendRequest() => $_clearField(16);+ @$pb.TagNumber(16)+ FriendRequest ensureFriendRequest() => $_ensure(15);++ @$pb.TagNumber(17)+ Profile get profileChanged => $_getN(16);+ @$pb.TagNumber(17)+ set profileChanged(Profile value) => $_setField(17, value);+ @$pb.TagNumber(17)+ $core.bool hasProfileChanged() => $_has(16);+ @$pb.TagNumber(17)+ void clearProfileChanged() => $_clearField(17);+ @$pb.TagNumber(17)+ Profile ensureProfileChanged() => $_ensure(16);+}++class Profile extends $pb.GeneratedMessage {+ factory Profile({+ $core.String? displayName,+ $core.String? deviceId,+ $core.bool? hasAvatar,+ $core.List<$core.int>? avatarHash,+ }) {+ final result = Profile._();+ if (displayName != null) result.displayName = displayName;+ if (deviceId != null) result.deviceId = deviceId;+ if (hasAvatar != null) result.hasAvatar = hasAvatar;+ if (avatarHash != null) result.avatarHash = avatarHash;+ return result;+ }++ Profile._();++ factory Profile.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Profile()..mergeFromBuffer(data, registry);+ factory Profile.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Profile()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'Profile',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: Profile.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'displayName')+ ..aOS(2, _omitFieldNames ? '' : 'deviceId')+ ..aOB(3, _omitFieldNames ? '' : 'hasAvatar')+ ..a<$core.List<$core.int>>(+ 4, _omitFieldNames ? '' : 'avatarHash', $pb.PbFieldType.OY)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Profile clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Profile copyWith(void Function(Profile) updates) =>+ super.copyWith((message) => updates(message as Profile)) as Profile;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use Profile() / Profile.new instead')+ static Profile create() => Profile._();+ static $pb.GeneratedMessage $_createMessage() => Profile._();+ @$core.override+ Profile createEmptyInstance() => Profile._();+ @$core.pragma('dart2js:noInline')+ static Profile getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<Profile>(Profile.$_createMessage);+ static Profile? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get displayName => $_getSZ(0);+ @$pb.TagNumber(1)+ set displayName($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasDisplayName() => $_has(0);+ @$pb.TagNumber(1)+ void clearDisplayName() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.String get deviceId => $_getSZ(1);+ @$pb.TagNumber(2)+ set deviceId($core.String value) => $_setString(1, value);+ @$pb.TagNumber(2)+ $core.bool hasDeviceId() => $_has(1);+ @$pb.TagNumber(2)+ void clearDeviceId() => $_clearField(2);++ @$pb.TagNumber(3)+ $core.bool get hasAvatar => $_getBF(2);+ @$pb.TagNumber(3)+ set hasAvatar($core.bool value) => $_setBool(2, value);+ @$pb.TagNumber(3)+ $core.bool hasHasAvatar() => $_has(2);+ @$pb.TagNumber(3)+ void clearHasAvatar() => $_clearField(3);++ @$pb.TagNumber(4)+ $core.List<$core.int> get avatarHash => $_getN(3);+ @$pb.TagNumber(4)+ set avatarHash($core.List<$core.int> value) => $_setBytes(3, value);+ @$pb.TagNumber(4)+ $core.bool hasAvatarHash() => $_has(3);+ @$pb.TagNumber(4)+ void clearAvatarHash() => $_clearField(4);+}++class SetDisplayNameRequest extends $pb.GeneratedMessage {+ factory SetDisplayNameRequest({+ $core.String? name,+ }) {+ final result = SetDisplayNameRequest._();+ if (name != null) result.name = name;+ return result;+ }++ SetDisplayNameRequest._();++ factory SetDisplayNameRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetDisplayNameRequest()..mergeFromBuffer(data, registry);+ factory SetDisplayNameRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetDisplayNameRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'SetDisplayNameRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: SetDisplayNameRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'name')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetDisplayNameRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetDisplayNameRequest copyWith(+ void Function(SetDisplayNameRequest) updates) =>+ super.copyWith((message) => updates(message as SetDisplayNameRequest))+ as SetDisplayNameRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated(+ 'Use SetDisplayNameRequest() / SetDisplayNameRequest.new instead')+ static SetDisplayNameRequest create() => SetDisplayNameRequest._();+ static $pb.GeneratedMessage $_createMessage() => SetDisplayNameRequest._();+ @$core.override+ SetDisplayNameRequest createEmptyInstance() => SetDisplayNameRequest._();+ @$core.pragma('dart2js:noInline')+ static SetDisplayNameRequest getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<SetDisplayNameRequest>(+ SetDisplayNameRequest.$_createMessage);+ static SetDisplayNameRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get name => $_getSZ(0);+ @$pb.TagNumber(1)+ set name($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasName() => $_has(0);+ @$pb.TagNumber(1)+ void clearName() => $_clearField(1);+}++class SetAvatarRequest extends $pb.GeneratedMessage {+ factory SetAvatarRequest({+ $core.String? path,+ $core.double? cropX,+ $core.double? cropY,+ $core.double? cropSize,+ $core.List<$core.int>? image,+ }) {+ final result = SetAvatarRequest._();+ if (path != null) result.path = path;+ if (cropX != null) result.cropX = cropX;+ if (cropY != null) result.cropY = cropY;+ if (cropSize != null) result.cropSize = cropSize;+ if (image != null) result.image = image;+ return result;+ }++ SetAvatarRequest._();++ factory SetAvatarRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetAvatarRequest()..mergeFromBuffer(data, registry);+ factory SetAvatarRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetAvatarRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'SetAvatarRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: SetAvatarRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'path')+ ..aD(2, _omitFieldNames ? '' : 'cropX')+ ..aD(3, _omitFieldNames ? '' : 'cropY')+ ..aD(4, _omitFieldNames ? '' : 'cropSize')+ ..a<$core.List<$core.int>>(+ 5, _omitFieldNames ? '' : 'image', $pb.PbFieldType.OY)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetAvatarRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetAvatarRequest copyWith(void Function(SetAvatarRequest) updates) =>+ super.copyWith((message) => updates(message as SetAvatarRequest))+ as SetAvatarRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use SetAvatarRequest() / SetAvatarRequest.new instead')+ static SetAvatarRequest create() => SetAvatarRequest._();+ static $pb.GeneratedMessage $_createMessage() => SetAvatarRequest._();+ @$core.override+ SetAvatarRequest createEmptyInstance() => SetAvatarRequest._();+ @$core.pragma('dart2js:noInline')+ static SetAvatarRequest getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetAvatarRequest>(+ SetAvatarRequest.$_createMessage);+ static SetAvatarRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get path => $_getSZ(0);+ @$pb.TagNumber(1)+ set path($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasPath() => $_has(0);+ @$pb.TagNumber(1)+ void clearPath() => $_clearField(1);++ /// 裁剪区域,按原图的比例(0 到 1);都为 0 时取中间最大的正方形+ @$pb.TagNumber(2)+ $core.double get cropX => $_getN(1);+ @$pb.TagNumber(2)+ set cropX($core.double value) => $_setDouble(1, value);+ @$pb.TagNumber(2)+ $core.bool hasCropX() => $_has(1);+ @$pb.TagNumber(2)+ void clearCropX() => $_clearField(2);++ @$pb.TagNumber(3)+ $core.double get cropY => $_getN(2);+ @$pb.TagNumber(3)+ set cropY($core.double value) => $_setDouble(2, value);+ @$pb.TagNumber(3)+ $core.bool hasCropY() => $_has(2);+ @$pb.TagNumber(3)+ void clearCropY() => $_clearField(3);++ @$pb.TagNumber(4)+ $core.double get cropSize => $_getN(3);+ @$pb.TagNumber(4)+ set cropSize($core.double value) => $_setDouble(3, value);+ @$pb.TagNumber(4)+ $core.bool hasCropSize() => $_has(3);+ @$pb.TagNumber(4)+ void clearCropSize() => $_clearField(4);++ @$pb.TagNumber(5)+ $core.List<$core.int> get image => $_getN(4);+ @$pb.TagNumber(5)+ set image($core.List<$core.int> value) => $_setBytes(4, value);+ @$pb.TagNumber(5)+ $core.bool hasImage() => $_has(4);+ @$pb.TagNumber(5)+ void clearImage() => $_clearField(5);+}++class GetAvatarRequest extends $pb.GeneratedMessage {+ factory GetAvatarRequest({+ $core.String? deviceId,+ }) {+ final result = GetAvatarRequest._();+ if (deviceId != null) result.deviceId = deviceId;+ return result;+ }++ GetAvatarRequest._();++ factory GetAvatarRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetAvatarRequest()..mergeFromBuffer(data, registry);+ factory GetAvatarRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetAvatarRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'GetAvatarRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: GetAvatarRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'deviceId')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetAvatarRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetAvatarRequest copyWith(void Function(GetAvatarRequest) updates) =>+ super.copyWith((message) => updates(message as GetAvatarRequest))+ as GetAvatarRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use GetAvatarRequest() / GetAvatarRequest.new instead')+ static GetAvatarRequest create() => GetAvatarRequest._();+ static $pb.GeneratedMessage $_createMessage() => GetAvatarRequest._();+ @$core.override+ GetAvatarRequest createEmptyInstance() => GetAvatarRequest._();+ @$core.pragma('dart2js:noInline')+ static GetAvatarRequest getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GetAvatarRequest>(+ GetAvatarRequest.$_createMessage);+ static GetAvatarRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get deviceId => $_getSZ(0);+ @$pb.TagNumber(1)+ set deviceId($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasDeviceId() => $_has(0);+ @$pb.TagNumber(1)+ void clearDeviceId() => $_clearField(1);+}++class Avatar extends $pb.GeneratedMessage {+ factory Avatar({+ $core.List<$core.int>? jpeg,+ $core.List<$core.int>? avatarHash,+ }) {+ final result = Avatar._();+ if (jpeg != null) result.jpeg = jpeg;+ if (avatarHash != null) result.avatarHash = avatarHash;+ return result;+ }++ Avatar._();++ factory Avatar.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Avatar()..mergeFromBuffer(data, registry);+ factory Avatar.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Avatar()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'Avatar',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: Avatar.$_createMessage)+ ..a<$core.List<$core.int>>(+ 1, _omitFieldNames ? '' : 'jpeg', $pb.PbFieldType.OY)+ ..a<$core.List<$core.int>>(+ 2, _omitFieldNames ? '' : 'avatarHash', $pb.PbFieldType.OY)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Avatar clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Avatar copyWith(void Function(Avatar) updates) =>+ super.copyWith((message) => updates(message as Avatar)) as Avatar;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use Avatar() / Avatar.new instead')+ static Avatar create() => Avatar._();+ static $pb.GeneratedMessage $_createMessage() => Avatar._();+ @$core.override+ Avatar createEmptyInstance() => Avatar._();+ @$core.pragma('dart2js:noInline')+ static Avatar getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<Avatar>(Avatar.$_createMessage);+ static Avatar? _defaultInstance;++ @$pb.TagNumber(1)+ $core.List<$core.int> get jpeg => $_getN(0);+ @$pb.TagNumber(1)+ set jpeg($core.List<$core.int> value) => $_setBytes(0, value);+ @$pb.TagNumber(1)+ $core.bool hasJpeg() => $_has(0);+ @$pb.TagNumber(1)+ void clearJpeg() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.List<$core.int> get avatarHash => $_getN(1);+ @$pb.TagNumber(2)+ set avatarHash($core.List<$core.int> value) => $_setBytes(1, value);+ @$pb.TagNumber(2)+ $core.bool hasAvatarHash() => $_has(1);+ @$pb.TagNumber(2)+ void clearAvatarHash() => $_clearField(2);+}++class FriendRef extends $pb.GeneratedMessage {+ factory FriendRef({+ $core.String? deviceId,+ }) {+ final result = FriendRef._();+ if (deviceId != null) result.deviceId = deviceId;+ return result;+ }++ FriendRef._();++ factory FriendRef.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendRef()..mergeFromBuffer(data, registry);+ factory FriendRef.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendRef()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'FriendRef',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: FriendRef.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'deviceId')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendRef clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendRef copyWith(void Function(FriendRef) updates) =>+ super.copyWith((message) => updates(message as FriendRef)) as FriendRef;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use FriendRef() / FriendRef.new instead')+ static FriendRef create() => FriendRef._();+ static $pb.GeneratedMessage $_createMessage() => FriendRef._();+ @$core.override+ FriendRef createEmptyInstance() => FriendRef._();+ @$core.pragma('dart2js:noInline')+ static FriendRef getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<FriendRef>(FriendRef.$_createMessage);+ static FriendRef? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get deviceId => $_getSZ(0);+ @$pb.TagNumber(1)+ set deviceId($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasDeviceId() => $_has(0);+ @$pb.TagNumber(1)+ void clearDeviceId() => $_clearField(1);+}++class SetFriendAutoAcceptRequest extends $pb.GeneratedMessage {+ factory SetFriendAutoAcceptRequest({+ $core.String? deviceId,+ $core.bool? autoAccept,+ }) {+ final result = SetFriendAutoAcceptRequest._();+ if (deviceId != null) result.deviceId = deviceId;+ if (autoAccept != null) result.autoAccept = autoAccept;+ return result;+ }++ SetFriendAutoAcceptRequest._();++ factory SetFriendAutoAcceptRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetFriendAutoAcceptRequest()..mergeFromBuffer(data, registry);+ factory SetFriendAutoAcceptRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetFriendAutoAcceptRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'SetFriendAutoAcceptRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: SetFriendAutoAcceptRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'deviceId')+ ..aOB(2, _omitFieldNames ? '' : 'autoAccept')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetFriendAutoAcceptRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetFriendAutoAcceptRequest copyWith(+ void Function(SetFriendAutoAcceptRequest) updates) =>+ super.copyWith(+ (message) => updates(message as SetFriendAutoAcceptRequest))+ as SetFriendAutoAcceptRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated(+ 'Use SetFriendAutoAcceptRequest() / SetFriendAutoAcceptRequest.new instead')+ static SetFriendAutoAcceptRequest create() => SetFriendAutoAcceptRequest._();+ static $pb.GeneratedMessage $_createMessage() =>+ SetFriendAutoAcceptRequest._();+ @$core.override+ SetFriendAutoAcceptRequest createEmptyInstance() =>+ SetFriendAutoAcceptRequest._();+ @$core.pragma('dart2js:noInline')+ static SetFriendAutoAcceptRequest getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<SetFriendAutoAcceptRequest>(+ SetFriendAutoAcceptRequest.$_createMessage);+ static SetFriendAutoAcceptRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get deviceId => $_getSZ(0);+ @$pb.TagNumber(1)+ set deviceId($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasDeviceId() => $_has(0);+ @$pb.TagNumber(1)+ void clearDeviceId() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.bool get autoAccept => $_getBF(1);+ @$pb.TagNumber(2)+ set autoAccept($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasAutoAccept() => $_has(1);+ @$pb.TagNumber(2)+ void clearAutoAccept() => $_clearField(2);+}++/// 好友就是对方的一台电脑+class Friend extends $pb.GeneratedMessage {+ factory Friend({+ $core.String? id,+ $core.String? displayName,+ $core.String? deviceName,+ $core.String? platform,+ $core.bool? online,+ ConnectionKind? connection,+ $core.bool? lanReachable,+ $core.bool? featuresKnown,+ $core.bool? receivesFiles,+ $core.bool? receiveDisabled,+ $core.String? appVersion,+ $core.bool? autoAccept,+ $fixnum.Int64? addedAtUnix,+ $fixnum.Int64? lastActivityUnix,+ $core.String? reachability,+ $core.bool? hasAvatar,+ $core.List<$core.int>? avatarHash,+ $core.String? fingerprint,+ }) {+ final result = Friend._();+ if (id != null) result.id = id;+ if (displayName != null) result.displayName = displayName;+ if (deviceName != null) result.deviceName = deviceName;+ if (platform != null) result.platform = platform;+ if (online != null) result.online = online;+ if (connection != null) result.connection = connection;+ if (lanReachable != null) result.lanReachable = lanReachable;+ if (featuresKnown != null) result.featuresKnown = featuresKnown;+ if (receivesFiles != null) result.receivesFiles = receivesFiles;+ if (receiveDisabled != null) result.receiveDisabled = receiveDisabled;+ if (appVersion != null) result.appVersion = appVersion;+ if (autoAccept != null) result.autoAccept = autoAccept;+ if (addedAtUnix != null) result.addedAtUnix = addedAtUnix;+ if (lastActivityUnix != null) result.lastActivityUnix = lastActivityUnix;+ if (reachability != null) result.reachability = reachability;+ if (hasAvatar != null) result.hasAvatar = hasAvatar;+ if (avatarHash != null) result.avatarHash = avatarHash;+ if (fingerprint != null) result.fingerprint = fingerprint;+ return result;+ }++ Friend._();++ factory Friend.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Friend()..mergeFromBuffer(data, registry);+ factory Friend.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Friend()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'Friend',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: Friend.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'id')+ ..aOS(2, _omitFieldNames ? '' : 'displayName')+ ..aOS(3, _omitFieldNames ? '' : 'deviceName')+ ..aOS(4, _omitFieldNames ? '' : 'platform')+ ..aOB(5, _omitFieldNames ? '' : 'online')+ ..aE<ConnectionKind>(6, _omitFieldNames ? '' : 'connection',+ enumValues: ConnectionKind.values)+ ..aOB(7, _omitFieldNames ? '' : 'lanReachable')+ ..aOB(8, _omitFieldNames ? '' : 'featuresKnown')+ ..aOB(9, _omitFieldNames ? '' : 'receivesFiles')+ ..aOB(10, _omitFieldNames ? '' : 'receiveDisabled')+ ..aOS(11, _omitFieldNames ? '' : 'appVersion')+ ..aOB(12, _omitFieldNames ? '' : 'autoAccept')+ ..aInt64(13, _omitFieldNames ? '' : 'addedAtUnix')+ ..aInt64(14, _omitFieldNames ? '' : 'lastActivityUnix')+ ..aOS(15, _omitFieldNames ? '' : 'reachability')+ ..aOB(16, _omitFieldNames ? '' : 'hasAvatar')+ ..a<$core.List<$core.int>>(+ 17, _omitFieldNames ? '' : 'avatarHash', $pb.PbFieldType.OY)+ ..aOS(18, _omitFieldNames ? '' : 'fingerprint')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Friend clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Friend copyWith(void Function(Friend) updates) =>+ super.copyWith((message) => updates(message as Friend)) as Friend;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use Friend() / Friend.new instead')+ static Friend create() => Friend._();+ static $pb.GeneratedMessage $_createMessage() => Friend._();+ @$core.override+ Friend createEmptyInstance() => Friend._();+ @$core.pragma('dart2js:noInline')+ static Friend getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<Friend>(Friend.$_createMessage);+ static Friend? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get id => $_getSZ(0);+ @$pb.TagNumber(1)+ set id($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasId() => $_has(0);+ @$pb.TagNumber(1)+ void clearId() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.String get displayName => $_getSZ(1);+ @$pb.TagNumber(2)+ set displayName($core.String value) => $_setString(1, value);+ @$pb.TagNumber(2)+ $core.bool hasDisplayName() => $_has(1);+ @$pb.TagNumber(2)+ void clearDisplayName() => $_clearField(2);++ @$pb.TagNumber(3)+ $core.String get deviceName => $_getSZ(2);+ @$pb.TagNumber(3)+ set deviceName($core.String value) => $_setString(2, value);+ @$pb.TagNumber(3)+ $core.bool hasDeviceName() => $_has(2);+ @$pb.TagNumber(3)+ void clearDeviceName() => $_clearField(3);++ @$pb.TagNumber(4)+ $core.String get platform => $_getSZ(3);+ @$pb.TagNumber(4)+ set platform($core.String value) => $_setString(3, value);+ @$pb.TagNumber(4)+ $core.bool hasPlatform() => $_has(3);+ @$pb.TagNumber(4)+ void clearPlatform() => $_clearField(4);++ @$pb.TagNumber(5)+ $core.bool get online => $_getBF(4);+ @$pb.TagNumber(5)+ set online($core.bool value) => $_setBool(4, value);+ @$pb.TagNumber(5)+ $core.bool hasOnline() => $_has(4);+ @$pb.TagNumber(5)+ void clearOnline() => $_clearField(5);++ @$pb.TagNumber(6)+ ConnectionKind get connection => $_getN(5);+ @$pb.TagNumber(6)+ set connection(ConnectionKind value) => $_setField(6, value);+ @$pb.TagNumber(6)+ $core.bool hasConnection() => $_has(5);+ @$pb.TagNumber(6)+ void clearConnection() => $_clearField(6);++ @$pb.TagNumber(7)+ $core.bool get lanReachable => $_getBF(6);+ @$pb.TagNumber(7)+ set lanReachable($core.bool value) => $_setBool(6, value);+ @$pb.TagNumber(7)+ $core.bool hasLanReachable() => $_has(6);+ @$pb.TagNumber(7)+ void clearLanReachable() => $_clearField(7);++ /// 与 Device 相同:已经知道对方支持哪些功能+ @$pb.TagNumber(8)+ $core.bool get featuresKnown => $_getBF(7);+ @$pb.TagNumber(8)+ set featuresKnown($core.bool value) => $_setBool(7, value);+ @$pb.TagNumber(8)+ $core.bool hasFeaturesKnown() => $_has(7);+ @$pb.TagNumber(8)+ void clearFeaturesKnown() => $_clearField(8);++ /// 对方能接收好友发来的文件(声明了 send_files_ask_v1 且没有选「均不允许」)+ @$pb.TagNumber(9)+ $core.bool get receivesFiles => $_getBF(8);+ @$pb.TagNumber(9)+ set receivesFiles($core.bool value) => $_setBool(8, value);+ @$pb.TagNumber(9)+ $core.bool hasReceivesFiles() => $_has(8);+ @$pb.TagNumber(9)+ void clearReceivesFiles() => $_clearField(9);++ /// 对方选了「均不允许」+ @$pb.TagNumber(10)+ $core.bool get receiveDisabled => $_getBF(9);+ @$pb.TagNumber(10)+ set receiveDisabled($core.bool value) => $_setBool(9, value);+ @$pb.TagNumber(10)+ $core.bool hasReceiveDisabled() => $_has(9);+ @$pb.TagNumber(10)+ void clearReceiveDisabled() => $_clearField(10);++ @$pb.TagNumber(11)+ $core.String get appVersion => $_getSZ(10);+ @$pb.TagNumber(11)+ set appVersion($core.String value) => $_setString(10, value);+ @$pb.TagNumber(11)+ $core.bool hasAppVersion() => $_has(10);+ @$pb.TagNumber(11)+ void clearAppVersion() => $_clearField(11);++ @$pb.TagNumber(12)+ $core.bool get autoAccept => $_getBF(11);+ @$pb.TagNumber(12)+ set autoAccept($core.bool value) => $_setBool(11, value);+ @$pb.TagNumber(12)+ $core.bool hasAutoAccept() => $_has(11);+ @$pb.TagNumber(12)+ void clearAutoAccept() => $_clearField(12);++ @$pb.TagNumber(13)+ $fixnum.Int64 get addedAtUnix => $_getI64(12);+ @$pb.TagNumber(13)+ set addedAtUnix($fixnum.Int64 value) => $_setInt64(12, value);+ @$pb.TagNumber(13)+ $core.bool hasAddedAtUnix() => $_has(12);+ @$pb.TagNumber(13)+ void clearAddedAtUnix() => $_clearField(13);++ @$pb.TagNumber(14)+ $fixnum.Int64 get lastActivityUnix => $_getI64(13);+ @$pb.TagNumber(14)+ set lastActivityUnix($fixnum.Int64 value) => $_setInt64(13, value);+ @$pb.TagNumber(14)+ $core.bool hasLastActivityUnix() => $_has(13);+ @$pb.TagNumber(14)+ void clearLastActivityUnix() => $_clearField(14);++ /// 连不上的原因,见 design/friends-send.md 第 9.2 节:+ /// ""(不用提示)、"self_no_service"(本机没开服务)、"peer_no_service"(对方没开服务)、+ /// "different_server"(两边用的不是同一台服务器)+ @$pb.TagNumber(15)+ $core.String get reachability => $_getSZ(14);+ @$pb.TagNumber(15)+ set reachability($core.String value) => $_setString(14, value);+ @$pb.TagNumber(15)+ $core.bool hasReachability() => $_has(14);+ @$pb.TagNumber(15)+ void clearReachability() => $_clearField(15);++ @$pb.TagNumber(16)+ $core.bool get hasAvatar => $_getBF(15);+ @$pb.TagNumber(16)+ set hasAvatar($core.bool value) => $_setBool(15, value);+ @$pb.TagNumber(16)+ $core.bool hasHasAvatar() => $_has(15);+ @$pb.TagNumber(16)+ void clearHasAvatar() => $_clearField(16);++ @$pb.TagNumber(17)+ $core.List<$core.int> get avatarHash => $_getN(16);+ @$pb.TagNumber(17)+ set avatarHash($core.List<$core.int> value) => $_setBytes(16, value);+ @$pb.TagNumber(17)+ $core.bool hasAvatarHash() => $_has(16);+ @$pb.TagNumber(17)+ void clearAvatarHash() => $_clearField(17);++ @$pb.TagNumber(18)+ $core.String get fingerprint => $_getSZ(17);+ @$pb.TagNumber(18)+ set fingerprint($core.String value) => $_setString(17, value);+ @$pb.TagNumber(18)+ $core.bool hasFingerprint() => $_has(17);+ @$pb.TagNumber(18)+ void clearFingerprint() => $_clearField(18);+}++class ListFriendsResponse extends $pb.GeneratedMessage {+ factory ListFriendsResponse({+ $core.Iterable<Friend>? friends,+ }) {+ final result = ListFriendsResponse._();+ if (friends != null) result.friends.addAll(friends);+ return result;+ }++ ListFriendsResponse._();++ factory ListFriendsResponse.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ListFriendsResponse()..mergeFromBuffer(data, registry);+ factory ListFriendsResponse.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ListFriendsResponse()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ListFriendsResponse',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ListFriendsResponse.$_createMessage)+ ..pPM<Friend>(1, _omitFieldNames ? '' : 'friends',+ subBuilder: Friend.$_createMessage)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ListFriendsResponse clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ListFriendsResponse copyWith(void Function(ListFriendsResponse) updates) =>+ super.copyWith((message) => updates(message as ListFriendsResponse))+ as ListFriendsResponse;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core+ .Deprecated('Use ListFriendsResponse() / ListFriendsResponse.new instead')+ static ListFriendsResponse create() => ListFriendsResponse._();+ static $pb.GeneratedMessage $_createMessage() => ListFriendsResponse._();+ @$core.override+ ListFriendsResponse createEmptyInstance() => ListFriendsResponse._();+ @$core.pragma('dart2js:noInline')+ static ListFriendsResponse getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<ListFriendsResponse>(+ ListFriendsResponse.$_createMessage);+ static ListFriendsResponse? _defaultInstance;++ @$pb.TagNumber(1)+ $pb.PbList<Friend> get friends => $_getList(0);+}++/// 加好友时等待用户确认的对方信息+class FriendRequest extends $pb.GeneratedMessage {+ factory FriendRequest({+ $core.String? session,+ $core.String? deviceId,+ $core.String? displayName,+ $core.String? deviceName,+ $core.String? platform,+ $core.String? fingerprint,+ $core.String? selfFingerprint,+ }) {+ final result = FriendRequest._();+ if (session != null) result.session = session;+ if (deviceId != null) result.deviceId = deviceId;+ if (displayName != null) result.displayName = displayName;+ if (deviceName != null) result.deviceName = deviceName;+ if (platform != null) result.platform = platform;+ if (fingerprint != null) result.fingerprint = fingerprint;+ if (selfFingerprint != null) result.selfFingerprint = selfFingerprint;+ return result;+ }++ FriendRequest._();++ factory FriendRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendRequest()..mergeFromBuffer(data, registry);+ factory FriendRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'FriendRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: FriendRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'session')+ ..aOS(2, _omitFieldNames ? '' : 'deviceId')+ ..aOS(3, _omitFieldNames ? '' : 'displayName')+ ..aOS(4, _omitFieldNames ? '' : 'deviceName')+ ..aOS(5, _omitFieldNames ? '' : 'platform')+ ..aOS(6, _omitFieldNames ? '' : 'fingerprint')+ ..aOS(7, _omitFieldNames ? '' : 'selfFingerprint')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendRequest copyWith(void Function(FriendRequest) updates) =>+ super.copyWith((message) => updates(message as FriendRequest))+ as FriendRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use FriendRequest() / FriendRequest.new instead')+ static FriendRequest create() => FriendRequest._();+ static $pb.GeneratedMessage $_createMessage() => FriendRequest._();+ @$core.override+ FriendRequest createEmptyInstance() => FriendRequest._();+ @$core.pragma('dart2js:noInline')+ static FriendRequest getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<FriendRequest>(+ FriendRequest.$_createMessage);+ static FriendRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get session => $_getSZ(0);@$pb.TagNumber(1)- $core.bool hasClipAdded() => $_has(0);+ set session($core.String value) => $_setString(0, value);@$pb.TagNumber(1)- void clearClipAdded() => $_clearField(1);+ $core.bool hasSession() => $_has(0);@$pb.TagNumber(1)- ClipRecord ensureClipAdded() => $_ensure(0);+ void clearSession() => $_clearField(1);@$pb.TagNumber(2)- ClipRecord get clipUpdated => $_getN(1);- @$pb.TagNumber(2)- set clipUpdated(ClipRecord value) => $_setField(2, value);+ $core.String get deviceId => $_getSZ(1);@$pb.TagNumber(2)- $core.bool hasClipUpdated() => $_has(1);+ set deviceId($core.String value) => $_setString(1, value);@$pb.TagNumber(2)- void clearClipUpdated() => $_clearField(2);+ $core.bool hasDeviceId() => $_has(1);@$pb.TagNumber(2)- ClipRecord ensureClipUpdated() => $_ensure(1);+ void clearDeviceId() => $_clearField(2);@$pb.TagNumber(3)- $core.String get clipRemoved => $_getSZ(2);+ $core.String get displayName => $_getSZ(2);@$pb.TagNumber(3)- set clipRemoved($core.String value) => $_setString(2, value);+ set displayName($core.String value) => $_setString(2, value);@$pb.TagNumber(3)- $core.bool hasClipRemoved() => $_has(2);+ $core.bool hasDisplayName() => $_has(2);@$pb.TagNumber(3)- void clearClipRemoved() => $_clearField(3);+ void clearDisplayName() => $_clearField(3);@$pb.TagNumber(4)- TransferProgress get progress => $_getN(3);- @$pb.TagNumber(4)- set progress(TransferProgress value) => $_setField(4, value);+ $core.String get deviceName => $_getSZ(3);@$pb.TagNumber(4)- $core.bool hasProgress() => $_has(3);+ set deviceName($core.String value) => $_setString(3, value);@$pb.TagNumber(4)- void clearProgress() => $_clearField(4);+ $core.bool hasDeviceName() => $_has(3);@$pb.TagNumber(4)- TransferProgress ensureProgress() => $_ensure(3);+ void clearDeviceName() => $_clearField(4);@$pb.TagNumber(5)- Device get deviceChanged => $_getN(4);- @$pb.TagNumber(5)- set deviceChanged(Device value) => $_setField(5, value);+ $core.String get platform => $_getSZ(4);@$pb.TagNumber(5)- $core.bool hasDeviceChanged() => $_has(4);+ set platform($core.String value) => $_setString(4, value);@$pb.TagNumber(5)- void clearDeviceChanged() => $_clearField(5);+ $core.bool hasPlatform() => $_has(4);@$pb.TagNumber(5)- Device ensureDeviceChanged() => $_ensure(4);+ void clearPlatform() => $_clearField(5);+ /// 两边的安全指纹,面对面时可以核对@$pb.TagNumber(6)- ClipboardPermission get permissionChanged => $_getN(5);+ $core.String get fingerprint => $_getSZ(5);@$pb.TagNumber(6)- set permissionChanged(ClipboardPermission value) => $_setField(6, value);+ set fingerprint($core.String value) => $_setString(5, value);@$pb.TagNumber(6)- $core.bool hasPermissionChanged() => $_has(5);+ $core.bool hasFingerprint() => $_has(5);@$pb.TagNumber(6)- void clearPermissionChanged() => $_clearField(6);+ void clearFingerprint() => $_clearField(6);@$pb.TagNumber(7)- Status get statusChanged => $_getN(6);- @$pb.TagNumber(7)- set statusChanged(Status value) => $_setField(7, value);+ $core.String get selfFingerprint => $_getSZ(6);@$pb.TagNumber(7)- $core.bool hasStatusChanged() => $_has(6);+ set selfFingerprint($core.String value) => $_setString(6, value);@$pb.TagNumber(7)- void clearStatusChanged() => $_clearField(7);+ $core.bool hasSelfFingerprint() => $_has(6);@$pb.TagNumber(7)- Status ensureStatusChanged() => $_ensure(6);+ void clearSelfFingerprint() => $_clearField(7);+}- @$pb.TagNumber(8)- ClipboardWriteResult get clipboardWritten => $_getN(7);- @$pb.TagNumber(8)- set clipboardWritten(ClipboardWriteResult value) => $_setField(8, value);- @$pb.TagNumber(8)- $core.bool hasClipboardWritten() => $_has(7);- @$pb.TagNumber(8)- void clearClipboardWritten() => $_clearField(8);- @$pb.TagNumber(8)- ClipboardWriteResult ensureClipboardWritten() => $_ensure(7);+/// 附近开着「所有人」的陌生设备+class Stranger extends $pb.GeneratedMessage {+ factory Stranger({+ $core.String? id,+ $core.String? displayName,+ $core.String? deviceName,+ $core.String? platform,+ $core.bool? receivesFiles,+ }) {+ final result = Stranger._();+ if (id != null) result.id = id;+ if (displayName != null) result.displayName = displayName;+ if (deviceName != null) result.deviceName = deviceName;+ if (platform != null) result.platform = platform;+ if (receivesFiles != null) result.receivesFiles = receivesFiles;+ return result;+ }- /// 设置保存后推送,快捷窗口据此重新注册快捷键- @$pb.TagNumber(9)- Config get configChanged => $_getN(8);- @$pb.TagNumber(9)- set configChanged(Config value) => $_setField(9, value);- @$pb.TagNumber(9)- $core.bool hasConfigChanged() => $_has(8);- @$pb.TagNumber(9)- void clearConfigChanged() => $_clearField(9);- @$pb.TagNumber(9)- Config ensureConfigChanged() => $_ensure(8);+ Stranger._();- @$pb.TagNumber(10)- QuickPasteStatus get quickPasteChanged => $_getN(9);- @$pb.TagNumber(10)- set quickPasteChanged(QuickPasteStatus value) => $_setField(10, value);- @$pb.TagNumber(10)- $core.bool hasQuickPasteChanged() => $_has(9);- @$pb.TagNumber(10)- void clearQuickPasteChanged() => $_clearField(10);- @$pb.TagNumber(10)- QuickPasteStatus ensureQuickPasteChanged() => $_ensure(9);+ factory Stranger.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Stranger()..mergeFromBuffer(data, registry);+ factory Stranger.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Stranger()..mergeFromJson(json, registry);- /// 隔空传送的一批新建、状态变化或进度更新(进度 0.2 秒节流)- @$pb.TagNumber(11)- Transfer get transferChanged => $_getN(10);- @$pb.TagNumber(11)- set transferChanged(Transfer value) => $_setField(11, value);- @$pb.TagNumber(11)- $core.bool hasTransferChanged() => $_has(10);- @$pb.TagNumber(11)- void clearTransferChanged() => $_clearField(11);- @$pb.TagNumber(11)- Transfer ensureTransferChanged() => $_ensure(10);+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'Stranger',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: Stranger.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'id')+ ..aOS(2, _omitFieldNames ? '' : 'displayName')+ ..aOS(3, _omitFieldNames ? '' : 'deviceName')+ ..aOS(4, _omitFieldNames ? '' : 'platform')+ ..aOB(5, _omitFieldNames ? '' : 'receivesFiles')+ ..hasRequiredFields = false;- @$pb.TagNumber(12)- $core.String get transferRemoved => $_getSZ(11);- @$pb.TagNumber(12)- set transferRemoved($core.String value) => $_setString(11, value);- @$pb.TagNumber(12)- $core.bool hasTransferRemoved() => $_has(11);- @$pb.TagNumber(12)- void clearTransferRemoved() => $_clearField(12);+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Stranger clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Stranger copyWith(void Function(Stranger) updates) =>+ super.copyWith((message) => updates(message as Stranger)) as Stranger;- /// 让界面切到某一页:"send" 是隔空传送页(用户点了隔空传送的通知)。- /// 界面是被这次点击拉起来的话还没订阅,后台服务在它订阅时补发最近 15 秒内的这一条- @$pb.TagNumber(13)- $core.String get navigate => $_getSZ(12);- @$pb.TagNumber(13)- set navigate($core.String value) => $_setString(12, value);- @$pb.TagNumber(13)- $core.bool hasNavigate() => $_has(12);- @$pb.TagNumber(13)- void clearNavigate() => $_clearField(13);+ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use Stranger() / Stranger.new instead')+ static Stranger create() => Stranger._();+ static $pb.GeneratedMessage $_createMessage() => Stranger._();+ @$core.override+ Stranger createEmptyInstance() => Stranger._();+ @$core.pragma('dart2js:noInline')+ static Stranger getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<Stranger>(Stranger.$_createMessage);+ static Stranger? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get id => $_getSZ(0);+ @$pb.TagNumber(1)+ set id($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasId() => $_has(0);+ @$pb.TagNumber(1)+ void clearId() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.String get displayName => $_getSZ(1);+ @$pb.TagNumber(2)+ set displayName($core.String value) => $_setString(1, value);+ @$pb.TagNumber(2)+ $core.bool hasDisplayName() => $_has(1);+ @$pb.TagNumber(2)+ void clearDisplayName() => $_clearField(2);++ @$pb.TagNumber(3)+ $core.String get deviceName => $_getSZ(2);+ @$pb.TagNumber(3)+ set deviceName($core.String value) => $_setString(2, value);+ @$pb.TagNumber(3)+ $core.bool hasDeviceName() => $_has(2);+ @$pb.TagNumber(3)+ void clearDeviceName() => $_clearField(3);++ @$pb.TagNumber(4)+ $core.String get platform => $_getSZ(3);+ @$pb.TagNumber(4)+ set platform($core.String value) => $_setString(3, value);+ @$pb.TagNumber(4)+ $core.bool hasPlatform() => $_has(3);+ @$pb.TagNumber(4)+ void clearPlatform() => $_clearField(4);++ @$pb.TagNumber(5)+ $core.bool get receivesFiles => $_getBF(4);+ @$pb.TagNumber(5)+ set receivesFiles($core.bool value) => $_setBool(4, value);+ @$pb.TagNumber(5)+ $core.bool hasReceivesFiles() => $_has(4);+ @$pb.TagNumber(5)+ void clearReceivesFiles() => $_clearField(5);+}++class Strangers extends $pb.GeneratedMessage {+ factory Strangers({+ $core.Iterable<Stranger>? strangers,+ }) {+ final result = Strangers._();+ if (strangers != null) result.strangers.addAll(strangers);+ return result;+ }++ Strangers._();++ factory Strangers.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Strangers()..mergeFromBuffer(data, registry);+ factory Strangers.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ Strangers()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'Strangers',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: Strangers.$_createMessage)+ ..pPM<Stranger>(1, _omitFieldNames ? '' : 'strangers',+ subBuilder: Stranger.$_createMessage)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Strangers clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ Strangers copyWith(void Function(Strangers) updates) =>+ super.copyWith((message) => updates(message as Strangers)) as Strangers;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use Strangers() / Strangers.new instead')+ static Strangers create() => Strangers._();+ static $pb.GeneratedMessage $_createMessage() => Strangers._();+ @$core.override+ Strangers createEmptyInstance() => Strangers._();+ @$core.pragma('dart2js:noInline')+ static Strangers getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<Strangers>(Strangers.$_createMessage);+ static Strangers? _defaultInstance;++ @$pb.TagNumber(1)+ $pb.PbList<Stranger> get strangers => $_getList(0);}class NotificationStatus extends $pb.GeneratedMessage {@@ -3018,6 +4212,9 @@ class Config extends $pb.GeneratedMessage {$core.bool? realtimeSyncDisabled,$core.bool? syncBacklog,$core.Iterable<$core.String>? syncDisabledPeers,+ $core.String? receiveFrom,+ $fixnum.Int64? everyoneUntilUnix,+ $core.String? displayName,}) {final result = Config._();if (autoSyncThresholdBytes != null)@@ -3058,6 +4255,9 @@ class Config extends $pb.GeneratedMessage {if (syncBacklog != null) result.syncBacklog = syncBacklog;if (syncDisabledPeers != null)result.syncDisabledPeers.addAll(syncDisabledPeers);+ if (receiveFrom != null) result.receiveFrom = receiveFrom;+ if (everyoneUntilUnix != null) result.everyoneUntilUnix = everyoneUntilUnix;+ if (displayName != null) result.displayName = displayName;return result;}@@ -3104,6 +4304,9 @@ class Config extends $pb.GeneratedMessage {..aOB(27, _omitFieldNames ? '' : 'realtimeSyncDisabled')..aOB(28, _omitFieldNames ? '' : 'syncBacklog')..pPS(29, _omitFieldNames ? '' : 'syncDisabledPeers')+ ..aOS(30, _omitFieldNames ? '' : 'receiveFrom')+ ..aInt64(31, _omitFieldNames ? '' : 'everyoneUntilUnix')+ ..aOS(32, _omitFieldNames ? '' : 'displayName')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -3399,6 +4602,37 @@ class Config extends $pb.GeneratedMessage {@$pb.TagNumber(29)$pb.PbList<$core.String> get syncDisabledPeers => $_getList(28);++ /// 谁可以给我发文件(2.6.0):"off"(均不允许)、"friends"(仅限好友,默认)、"everyone"(所有人)。+ /// 只管别人;自己设备之间的发送看 receive_disabled+ @$pb.TagNumber(30)+ $core.String get receiveFrom => $_getSZ(29);+ @$pb.TagNumber(30)+ set receiveFrom($core.String value) => $_setString(29, value);+ @$pb.TagNumber(30)+ $core.bool hasReceiveFrom() => $_has(29);+ @$pb.TagNumber(30)+ void clearReceiveFrom() => $_clearField(30);++ /// 「所有人」在这个时间自动回到「仅限好友」,Unix 秒。打开「所有人」时由后台服务填上+ @$pb.TagNumber(31)+ $fixnum.Int64 get everyoneUntilUnix => $_getI64(30);+ @$pb.TagNumber(31)+ set everyoneUntilUnix($fixnum.Int64 value) => $_setInt64(30, value);+ @$pb.TagNumber(31)+ $core.bool hasEveryoneUntilUnix() => $_has(30);+ @$pb.TagNumber(31)+ void clearEveryoneUntilUnix() => $_clearField(31);++ /// 好友看到的名字,空表示系统的用户全名+ @$pb.TagNumber(32)+ $core.String get displayName => $_getSZ(31);+ @$pb.TagNumber(32)+ set displayName($core.String value) => $_setString(31, value);+ @$pb.TagNumber(32)+ $core.bool hasDisplayName() => $_has(31);+ @$pb.TagNumber(32)+ void clearDisplayName() => $_clearField(32);}class OfficialUsage extends $pb.GeneratedMessage {@@ -5166,11 +6400,13 @@ class SendFilesRequest extends $pb.GeneratedMessage {$core.String? deviceId,$core.Iterable<$core.String>? paths,$core.bool? allowRelay,+ $core.String? note,}) {final result = SendFilesRequest._();if (deviceId != null) result.deviceId = deviceId;if (paths != null) result.paths.addAll(paths);if (allowRelay != null) result.allowRelay = allowRelay;+ if (note != null) result.note = note;return result;}@@ -5190,6 +6426,7 @@ class SendFilesRequest extends $pb.GeneratedMessage {..aOS(1, _omitFieldNames ? '' : 'deviceId')..pPS(2, _omitFieldNames ? '' : 'paths')..aOB(3, _omitFieldNames ? '' : 'allowRelay')+ ..aOS(4, _omitFieldNames ? '' : 'note')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -5236,6 +6473,16 @@ class SendFilesRequest extends $pb.GeneratedMessage {$core.bool hasAllowRelay() => $_has(2);@$pb.TagNumber(3)void clearAllowRelay() => $_clearField(3);++ /// 备注,见 Transfer.note+ @$pb.TagNumber(4)+ $core.String get note => $_getSZ(3);+ @$pb.TagNumber(4)+ set note($core.String value) => $_setString(3, value);+ @$pb.TagNumber(4)+ $core.bool hasNote() => $_has(3);+ @$pb.TagNumber(4)+ void clearNote() => $_clearField(4);}class TransferRef extends $pb.GeneratedMessage {@@ -5319,6 +6566,9 @@ class Transfer extends $pb.GeneratedMessage {$fixnum.Int64? currentIndex,$core.Iterable<$core.bool>? present,$fixnum.Int64? renamedFiles,+ $core.String? peerRole,+ $core.String? note,+ $core.Iterable<$core.String>? thumbs,}) {final result = Transfer._();if (id != null) result.id = id;@@ -5343,6 +6593,9 @@ class Transfer extends $pb.GeneratedMessage {if (currentIndex != null) result.currentIndex = currentIndex;if (present != null) result.present.addAll(present);if (renamedFiles != null) result.renamedFiles = renamedFiles;+ if (peerRole != null) result.peerRole = peerRole;+ if (note != null) result.note = note;+ if (thumbs != null) result.thumbs.addAll(thumbs);return result;}@@ -5383,6 +6636,9 @@ class Transfer extends $pb.GeneratedMessage {..aInt64(20, _omitFieldNames ? '' : 'currentIndex')..p<$core.bool>(21, _omitFieldNames ? '' : 'present', $pb.PbFieldType.KB)..aInt64(22, _omitFieldNames ? '' : 'renamedFiles')+ ..aOS(23, _omitFieldNames ? '' : 'peerRole')+ ..aOS(24, _omitFieldNames ? '' : 'note')+ ..pPS(25, _omitFieldNames ? '' : 'thumbs')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -5496,6 +6752,7 @@ class Transfer extends $pb.GeneratedMessage {void clearBytesPerSecond() => $_clearField(11);/// 失败、回绝、取消的原因,固定代码,界面翻译:no_space、dest_unavailable、+ /// declined(对方拒绝)、timeout(对方没有回应)、not_allowed(对方不接收)、/// file_too_large、disabled、unsupported、offline、source_changed、source_missing、/// read_error、write_failed、hash_mismatch、cancelled、peer_cancelled、relay_quota 等@$pb.TagNumber(12)@@ -5593,6 +6850,114 @@ class Transfer extends $pb.GeneratedMessage {$core.bool hasRenamedFiles() => $_has(21);@$pb.TagNumber(22)void clearRenamedFiles() => $_clearField(22);++ /// 对方是谁(2.6.0):"self"(自己的设备)、"friend"、"stranger"(「所有人」模式下的陌生设备)+ @$pb.TagNumber(23)+ $core.String get peerRole => $_getSZ(22);+ @$pb.TagNumber(23)+ set peerRole($core.String value) => $_setString(22, value);+ @$pb.TagNumber(23)+ $core.bool hasPeerRole() => $_has(22);+ @$pb.TagNumber(23)+ void clearPeerRole() => $_clearField(23);++ /// 备注+ @$pb.TagNumber(24)+ $core.String get note => $_getSZ(23);+ @$pb.TagNumber(24)+ set note($core.String value) => $_setString(23, value);+ @$pb.TagNumber(24)+ $core.bool hasNote() => $_has(23);+ @$pb.TagNumber(24)+ void clearNote() => $_clearField(24);++ /// 收到的图片的缩略图(本机重新编码过的 PNG),与 items 一一对应,不是图片的为空+ @$pb.TagNumber(25)+ $pb.PbList<$core.String> get thumbs => $_getList(24);+}++class AnswerIncomingRequest extends $pb.GeneratedMessage {+ factory AnswerIncomingRequest({+ $core.String? transferId,+ $core.bool? accept,+ $core.bool? always,+ }) {+ final result = AnswerIncomingRequest._();+ if (transferId != null) result.transferId = transferId;+ if (accept != null) result.accept = accept;+ if (always != null) result.always = always;+ return result;+ }++ AnswerIncomingRequest._();++ factory AnswerIncomingRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ AnswerIncomingRequest()..mergeFromBuffer(data, registry);+ factory AnswerIncomingRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ AnswerIncomingRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'AnswerIncomingRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: AnswerIncomingRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'transferId')+ ..aOB(2, _omitFieldNames ? '' : 'accept')+ ..aOB(3, _omitFieldNames ? '' : 'always')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ AnswerIncomingRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ AnswerIncomingRequest copyWith(+ void Function(AnswerIncomingRequest) updates) =>+ super.copyWith((message) => updates(message as AnswerIncomingRequest))+ as AnswerIncomingRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated(+ 'Use AnswerIncomingRequest() / AnswerIncomingRequest.new instead')+ static AnswerIncomingRequest create() => AnswerIncomingRequest._();+ static $pb.GeneratedMessage $_createMessage() => AnswerIncomingRequest._();+ @$core.override+ AnswerIncomingRequest createEmptyInstance() => AnswerIncomingRequest._();+ @$core.pragma('dart2js:noInline')+ static AnswerIncomingRequest getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<AnswerIncomingRequest>(+ AnswerIncomingRequest.$_createMessage);+ static AnswerIncomingRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get transferId => $_getSZ(0);+ @$pb.TagNumber(1)+ set transferId($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasTransferId() => $_has(0);+ @$pb.TagNumber(1)+ void clearTransferId() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.bool get accept => $_getBF(1);+ @$pb.TagNumber(2)+ set accept($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasAccept() => $_has(1);+ @$pb.TagNumber(2)+ void clearAccept() => $_clearField(2);++ /// 以后自动接收这个好友的文件(陌生设备忽略)+ @$pb.TagNumber(3)+ $core.bool get always => $_getBF(2);+ @$pb.TagNumber(3)+ set always($core.bool value) => $_setBool(2, value);+ @$pb.TagNumber(3)+ $core.bool hasAlways() => $_has(2);+ @$pb.TagNumber(3)+ void clearAlways() => $_clearField(3);}class ListTransfersRequest extends $pb.GeneratedMessage {diff --git a/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart b/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dartindex 6e5f19a..3ae5ea4 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart@@ -376,6 +376,114 @@ class DaemonServiceClient extends $grpc.Client {return $createUnaryCall(_$checkReceiveDir, request, options: options);}+ /// 别人发来的、在等用户接受的一批:接受或拒绝。always 表示以后自动接收这个好友的文件+ $grpc.ResponseFuture<$0.Empty> answerIncoming(+ $0.AnswerIncomingRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$answerIncoming, request, options: options);+ }++ /// ── 好友,见 design/friends-send.md ──+ $grpc.ResponseFuture<$0.Profile> getProfile(+ $0.Empty request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$getProfile, request, options: options);+ }++ $grpc.ResponseFuture<$0.Profile> setDisplayName(+ $0.SetDisplayNameRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$setDisplayName, request, options: options);+ }++ /// 设置头像:图片文件或剪贴板里的图片,按裁剪区域裁成正方形,处理成 256×256 的 JPEG+ $grpc.ResponseFuture<$0.Profile> setAvatar(+ $0.SetAvatarRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$setAvatar, request, options: options);+ }++ $grpc.ResponseFuture<$0.Profile> resetAvatar(+ $0.Empty request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$resetAvatar, request, options: options);+ }++ /// 本机或某个好友的头像(JPEG)。没有自定义头像时为空+ $grpc.ResponseFuture<$0.Avatar> getAvatar(+ $0.GetAvatarRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$getAvatar, request, options: options);+ }++ /// 生成好友码(F 加 6 位),5 分钟有效。别人兑换后推送 friend_request 事件+ $grpc.ResponseFuture<$0.CreatePairingCodeResponse> createFriendCode(+ $0.Empty request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$createFriendCode, request, options: options);+ }++ /// 输入好友码,返回对方的名片和会话;用户在确认框里点了以后调 ConfirmFriend+ $grpc.ResponseFuture<$0.FriendRequest> redeemFriendCode(+ $0.RedeemPairingCodeRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$redeemFriendCode, request, options: options);+ }++ $grpc.ResponseFuture<$0.Empty> confirmFriend(+ $0.ConfirmPairingRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$confirmFriend, request, options: options);+ }++ $grpc.ResponseFuture<$0.ListFriendsResponse> listFriends(+ $0.Empty request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$listFriends, request, options: options);+ }++ $grpc.ResponseFuture<$0.Empty> removeFriend(+ $0.FriendRef request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$removeFriend, request, options: options);+ }++ $grpc.ResponseFuture<$0.Friend> setFriendAutoAccept(+ $0.SetFriendAutoAcceptRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$setFriendAutoAccept, request, options: options);+ }++ /// 「所有人」模式下拒绝过的陌生设备,以后它的请求直接拒绝+ $grpc.ResponseFuture<$0.Empty> blockDevice(+ $0.FriendRef request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$blockDevice, request, options: options);+ }++ /// 隔空传送页打开期间保持这个调用:推送附近开着「所有人」的陌生设备(只在局域网里)+ $grpc.ResponseStream<$0.Strangers> watchStrangers(+ $0.Empty request, {+ $grpc.CallOptions? options,+ }) {+ return $createStreamingCall(+ _$watchStrangers, $async.Stream.fromIterable([request]),+ options: options);+ }+// method descriptorsstatic final _$subscribe = $grpc.ClientMethod<$0.SubscribeRequest, $0.Event>(@@ -577,6 +685,70 @@ class DaemonServiceClient extends $grpc.Client {'/pasteferry.v1.DaemonService/CheckReceiveDir',($0.CheckReceiveDirRequest value) => value.writeToBuffer(),$0.CheckReceiveDirResponse.fromBuffer);+ static final _$answerIncoming =+ $grpc.ClientMethod<$0.AnswerIncomingRequest, $0.Empty>(+ '/pasteferry.v1.DaemonService/AnswerIncoming',+ ($0.AnswerIncomingRequest value) => value.writeToBuffer(),+ $0.Empty.fromBuffer);+ static final _$getProfile = $grpc.ClientMethod<$0.Empty, $0.Profile>(+ '/pasteferry.v1.DaemonService/GetProfile',+ ($0.Empty value) => value.writeToBuffer(),+ $0.Profile.fromBuffer);+ static final _$setDisplayName =+ $grpc.ClientMethod<$0.SetDisplayNameRequest, $0.Profile>(+ '/pasteferry.v1.DaemonService/SetDisplayName',+ ($0.SetDisplayNameRequest value) => value.writeToBuffer(),+ $0.Profile.fromBuffer);+ static final _$setAvatar =+ $grpc.ClientMethod<$0.SetAvatarRequest, $0.Profile>(+ '/pasteferry.v1.DaemonService/SetAvatar',+ ($0.SetAvatarRequest value) => value.writeToBuffer(),+ $0.Profile.fromBuffer);+ static final _$resetAvatar = $grpc.ClientMethod<$0.Empty, $0.Profile>(+ '/pasteferry.v1.DaemonService/ResetAvatar',+ ($0.Empty value) => value.writeToBuffer(),+ $0.Profile.fromBuffer);+ static final _$getAvatar = $grpc.ClientMethod<$0.GetAvatarRequest, $0.Avatar>(+ '/pasteferry.v1.DaemonService/GetAvatar',+ ($0.GetAvatarRequest value) => value.writeToBuffer(),+ $0.Avatar.fromBuffer);+ static final _$createFriendCode =+ $grpc.ClientMethod<$0.Empty, $0.CreatePairingCodeResponse>(+ '/pasteferry.v1.DaemonService/CreateFriendCode',+ ($0.Empty value) => value.writeToBuffer(),+ $0.CreatePairingCodeResponse.fromBuffer);+ static final _$redeemFriendCode =+ $grpc.ClientMethod<$0.RedeemPairingCodeRequest, $0.FriendRequest>(+ '/pasteferry.v1.DaemonService/RedeemFriendCode',+ ($0.RedeemPairingCodeRequest value) => value.writeToBuffer(),+ $0.FriendRequest.fromBuffer);+ static final _$confirmFriend =+ $grpc.ClientMethod<$0.ConfirmPairingRequest, $0.Empty>(+ '/pasteferry.v1.DaemonService/ConfirmFriend',+ ($0.ConfirmPairingRequest value) => value.writeToBuffer(),+ $0.Empty.fromBuffer);+ static final _$listFriends =+ $grpc.ClientMethod<$0.Empty, $0.ListFriendsResponse>(+ '/pasteferry.v1.DaemonService/ListFriends',+ ($0.Empty value) => value.writeToBuffer(),+ $0.ListFriendsResponse.fromBuffer);+ static final _$removeFriend = $grpc.ClientMethod<$0.FriendRef, $0.Empty>(+ '/pasteferry.v1.DaemonService/RemoveFriend',+ ($0.FriendRef value) => value.writeToBuffer(),+ $0.Empty.fromBuffer);+ static final _$setFriendAutoAccept =+ $grpc.ClientMethod<$0.SetFriendAutoAcceptRequest, $0.Friend>(+ '/pasteferry.v1.DaemonService/SetFriendAutoAccept',+ ($0.SetFriendAutoAcceptRequest value) => value.writeToBuffer(),+ $0.Friend.fromBuffer);+ static final _$blockDevice = $grpc.ClientMethod<$0.FriendRef, $0.Empty>(+ '/pasteferry.v1.DaemonService/BlockDevice',+ ($0.FriendRef value) => value.writeToBuffer(),+ $0.Empty.fromBuffer);+ static final _$watchStrangers = $grpc.ClientMethod<$0.Empty, $0.Strangers>(+ '/pasteferry.v1.DaemonService/WatchStrangers',+ ($0.Empty value) => value.writeToBuffer(),+ $0.Strangers.fromBuffer);}@$pb.GrpcServiceName('pasteferry.v1.DaemonService')@@ -903,6 +1075,110 @@ abstract class DaemonServiceBase extends $grpc.Service {($core.List<$core.int> value) =>$0.CheckReceiveDirRequest.fromBuffer(value),($0.CheckReceiveDirResponse value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.AnswerIncomingRequest, $0.Empty>(+ 'AnswerIncoming',+ answerIncoming_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.AnswerIncomingRequest.fromBuffer(value),+ ($0.Empty value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.Empty, $0.Profile>(+ 'GetProfile',+ getProfile_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),+ ($0.Profile value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.SetDisplayNameRequest, $0.Profile>(+ 'SetDisplayName',+ setDisplayName_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.SetDisplayNameRequest.fromBuffer(value),+ ($0.Profile value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.SetAvatarRequest, $0.Profile>(+ 'SetAvatar',+ setAvatar_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.SetAvatarRequest.fromBuffer(value),+ ($0.Profile value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.Empty, $0.Profile>(+ 'ResetAvatar',+ resetAvatar_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),+ ($0.Profile value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.GetAvatarRequest, $0.Avatar>(+ 'GetAvatar',+ getAvatar_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.GetAvatarRequest.fromBuffer(value),+ ($0.Avatar value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.Empty, $0.CreatePairingCodeResponse>(+ 'CreateFriendCode',+ createFriendCode_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),+ ($0.CreatePairingCodeResponse value) => value.writeToBuffer()));+ $addMethod(+ $grpc.ServiceMethod<$0.RedeemPairingCodeRequest, $0.FriendRequest>(+ 'RedeemFriendCode',+ redeemFriendCode_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.RedeemPairingCodeRequest.fromBuffer(value),+ ($0.FriendRequest value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.ConfirmPairingRequest, $0.Empty>(+ 'ConfirmFriend',+ confirmFriend_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.ConfirmPairingRequest.fromBuffer(value),+ ($0.Empty value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.Empty, $0.ListFriendsResponse>(+ 'ListFriends',+ listFriends_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),+ ($0.ListFriendsResponse value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.FriendRef, $0.Empty>(+ 'RemoveFriend',+ removeFriend_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.FriendRef.fromBuffer(value),+ ($0.Empty value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.SetFriendAutoAcceptRequest, $0.Friend>(+ 'SetFriendAutoAccept',+ setFriendAutoAccept_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.SetFriendAutoAcceptRequest.fromBuffer(value),+ ($0.Friend value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.FriendRef, $0.Empty>(+ 'BlockDevice',+ blockDevice_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.FriendRef.fromBuffer(value),+ ($0.Empty value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.Empty, $0.Strangers>(+ 'WatchStrangers',+ watchStrangers_Pre,+ false,+ true,+ ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),+ ($0.Strangers value) => value.writeToBuffer()));}$async.Stream<$0.Event> subscribe_Pre($grpc.ServiceCall $call,@@ -1238,4 +1514,116 @@ abstract class DaemonServiceBase extends $grpc.Service {$async.Future<$0.CheckReceiveDirResponse> checkReceiveDir($grpc.ServiceCall call, $0.CheckReceiveDirRequest request);++ $async.Future<$0.Empty> answerIncoming_Pre($grpc.ServiceCall $call,+ $async.Future<$0.AnswerIncomingRequest> $request) async {+ return answerIncoming($call, await $request);+ }++ $async.Future<$0.Empty> answerIncoming(+ $grpc.ServiceCall call, $0.AnswerIncomingRequest request);++ $async.Future<$0.Profile> getProfile_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.Empty> $request) async {+ return getProfile($call, await $request);+ }++ $async.Future<$0.Profile> getProfile(+ $grpc.ServiceCall call, $0.Empty request);++ $async.Future<$0.Profile> setDisplayName_Pre($grpc.ServiceCall $call,+ $async.Future<$0.SetDisplayNameRequest> $request) async {+ return setDisplayName($call, await $request);+ }++ $async.Future<$0.Profile> setDisplayName(+ $grpc.ServiceCall call, $0.SetDisplayNameRequest request);++ $async.Future<$0.Profile> setAvatar_Pre($grpc.ServiceCall $call,+ $async.Future<$0.SetAvatarRequest> $request) async {+ return setAvatar($call, await $request);+ }++ $async.Future<$0.Profile> setAvatar(+ $grpc.ServiceCall call, $0.SetAvatarRequest request);++ $async.Future<$0.Profile> resetAvatar_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.Empty> $request) async {+ return resetAvatar($call, await $request);+ }++ $async.Future<$0.Profile> resetAvatar(+ $grpc.ServiceCall call, $0.Empty request);++ $async.Future<$0.Avatar> getAvatar_Pre($grpc.ServiceCall $call,+ $async.Future<$0.GetAvatarRequest> $request) async {+ return getAvatar($call, await $request);+ }++ $async.Future<$0.Avatar> getAvatar(+ $grpc.ServiceCall call, $0.GetAvatarRequest request);++ $async.Future<$0.CreatePairingCodeResponse> createFriendCode_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.Empty> $request) async {+ return createFriendCode($call, await $request);+ }++ $async.Future<$0.CreatePairingCodeResponse> createFriendCode(+ $grpc.ServiceCall call, $0.Empty request);++ $async.Future<$0.FriendRequest> redeemFriendCode_Pre($grpc.ServiceCall $call,+ $async.Future<$0.RedeemPairingCodeRequest> $request) async {+ return redeemFriendCode($call, await $request);+ }++ $async.Future<$0.FriendRequest> redeemFriendCode(+ $grpc.ServiceCall call, $0.RedeemPairingCodeRequest request);++ $async.Future<$0.Empty> confirmFriend_Pre($grpc.ServiceCall $call,+ $async.Future<$0.ConfirmPairingRequest> $request) async {+ return confirmFriend($call, await $request);+ }++ $async.Future<$0.Empty> confirmFriend(+ $grpc.ServiceCall call, $0.ConfirmPairingRequest request);++ $async.Future<$0.ListFriendsResponse> listFriends_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.Empty> $request) async {+ return listFriends($call, await $request);+ }++ $async.Future<$0.ListFriendsResponse> listFriends(+ $grpc.ServiceCall call, $0.Empty request);++ $async.Future<$0.Empty> removeFriend_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.FriendRef> $request) async {+ return removeFriend($call, await $request);+ }++ $async.Future<$0.Empty> removeFriend(+ $grpc.ServiceCall call, $0.FriendRef request);++ $async.Future<$0.Friend> setFriendAutoAccept_Pre($grpc.ServiceCall $call,+ $async.Future<$0.SetFriendAutoAcceptRequest> $request) async {+ return setFriendAutoAccept($call, await $request);+ }++ $async.Future<$0.Friend> setFriendAutoAccept(+ $grpc.ServiceCall call, $0.SetFriendAutoAcceptRequest request);++ $async.Future<$0.Empty> blockDevice_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.FriendRef> $request) async {+ return blockDevice($call, await $request);+ }++ $async.Future<$0.Empty> blockDevice(+ $grpc.ServiceCall call, $0.FriendRef request);++ $async.Stream<$0.Strangers> watchStrangers_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.Empty> $request) async* {+ yield* watchStrangers($call, await $request);+ }++ $async.Stream<$0.Strangers> watchStrangers(+ $grpc.ServiceCall call, $0.Empty request);}diff --git a/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart b/ui/lib/gen/pasteferry/v1/daemon.pbjson.dartindex 5c9f0b7..e4152a6 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart@@ -418,6 +418,41 @@ const Event$json = {'10': 'transferRemoved'},{'1': 'navigate', '3': 13, '4': 1, '5': 9, '9': 0, '10': 'navigate'},+ {+ '1': 'friend_changed',+ '3': 14,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.Friend',+ '9': 0,+ '10': 'friendChanged'+ },+ {+ '1': 'friend_removed',+ '3': 15,+ '4': 1,+ '5': 9,+ '9': 0,+ '10': 'friendRemoved'+ },+ {+ '1': 'friend_request',+ '3': 16,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.FriendRequest',+ '9': 0,+ '10': 'friendRequest'+ },+ {+ '1': 'profile_changed',+ '3': 17,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.Profile',+ '9': 0,+ '10': 'profileChanged'+ },],'8': [{'1': 'payload'},@@ -440,7 +475,246 @@ final $typed_data.Uint8List eventDescriptor = $convert.base64Decode('FuZ2VkGAogASgLMh8ucGFzdGVmZXJyeS52MS5RdWlja1Bhc3RlU3RhdHVzSABSEXF1aWNrUGFz''dGVDaGFuZ2VkEkQKEHRyYW5zZmVyX2NoYW5nZWQYCyABKAsyFy5wYXN0ZWZlcnJ5LnYxLlRyYW''5zZmVySABSD3RyYW5zZmVyQ2hhbmdlZBIrChB0cmFuc2Zlcl9yZW1vdmVkGAwgASgJSABSD3Ry'- 'YW5zZmVyUmVtb3ZlZBIcCghuYXZpZ2F0ZRgNIAEoCUgAUghuYXZpZ2F0ZUIJCgdwYXlsb2Fk');+ 'YW5zZmVyUmVtb3ZlZBIcCghuYXZpZ2F0ZRgNIAEoCUgAUghuYXZpZ2F0ZRI+Cg5mcmllbmRfY2'+ 'hhbmdlZBgOIAEoCzIVLnBhc3RlZmVycnkudjEuRnJpZW5kSABSDWZyaWVuZENoYW5nZWQSJwoO'+ 'ZnJpZW5kX3JlbW92ZWQYDyABKAlIAFINZnJpZW5kUmVtb3ZlZBJFCg5mcmllbmRfcmVxdWVzdB'+ 'gQIAEoCzIcLnBhc3RlZmVycnkudjEuRnJpZW5kUmVxdWVzdEgAUg1mcmllbmRSZXF1ZXN0EkEK'+ 'D3Byb2ZpbGVfY2hhbmdlZBgRIAEoCzIWLnBhc3RlZmVycnkudjEuUHJvZmlsZUgAUg5wcm9maW'+ 'xlQ2hhbmdlZEIJCgdwYXlsb2Fk');++@$core.Deprecated('Use profileDescriptor instead')+const Profile$json = {+ '1': 'Profile',+ '2': [+ {'1': 'display_name', '3': 1, '4': 1, '5': 9, '10': 'displayName'},+ {'1': 'device_id', '3': 2, '4': 1, '5': 9, '10': 'deviceId'},+ {'1': 'has_avatar', '3': 3, '4': 1, '5': 8, '10': 'hasAvatar'},+ {'1': 'avatar_hash', '3': 4, '4': 1, '5': 12, '10': 'avatarHash'},+ ],+};++/// Descriptor for `Profile`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List profileDescriptor = $convert.base64Decode(+ 'CgdQcm9maWxlEiEKDGRpc3BsYXlfbmFtZRgBIAEoCVILZGlzcGxheU5hbWUSGwoJZGV2aWNlX2'+ 'lkGAIgASgJUghkZXZpY2VJZBIdCgpoYXNfYXZhdGFyGAMgASgIUgloYXNBdmF0YXISHwoLYXZh'+ 'dGFyX2hhc2gYBCABKAxSCmF2YXRhckhhc2g=');++@$core.Deprecated('Use setDisplayNameRequestDescriptor instead')+const SetDisplayNameRequest$json = {+ '1': 'SetDisplayNameRequest',+ '2': [+ {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'},+ ],+};++/// Descriptor for `SetDisplayNameRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List setDisplayNameRequestDescriptor =+ $convert.base64Decode(+ 'ChVTZXREaXNwbGF5TmFtZVJlcXVlc3QSEgoEbmFtZRgBIAEoCVIEbmFtZQ==');++@$core.Deprecated('Use setAvatarRequestDescriptor instead')+const SetAvatarRequest$json = {+ '1': 'SetAvatarRequest',+ '2': [+ {'1': 'path', '3': 1, '4': 1, '5': 9, '10': 'path'},+ {'1': 'image', '3': 5, '4': 1, '5': 12, '10': 'image'},+ {'1': 'crop_x', '3': 2, '4': 1, '5': 1, '10': 'cropX'},+ {'1': 'crop_y', '3': 3, '4': 1, '5': 1, '10': 'cropY'},+ {'1': 'crop_size', '3': 4, '4': 1, '5': 1, '10': 'cropSize'},+ ],+};++/// Descriptor for `SetAvatarRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List setAvatarRequestDescriptor = $convert.base64Decode(+ 'ChBTZXRBdmF0YXJSZXF1ZXN0EhIKBHBhdGgYASABKAlSBHBhdGgSFAoFaW1hZ2UYBSABKAxSBW'+ 'ltYWdlEhUKBmNyb3BfeBgCIAEoAVIFY3JvcFgSFQoGY3JvcF95GAMgASgBUgVjcm9wWRIbCglj'+ 'cm9wX3NpemUYBCABKAFSCGNyb3BTaXpl');++@$core.Deprecated('Use getAvatarRequestDescriptor instead')+const GetAvatarRequest$json = {+ '1': 'GetAvatarRequest',+ '2': [+ {'1': 'device_id', '3': 1, '4': 1, '5': 9, '10': 'deviceId'},+ ],+};++/// Descriptor for `GetAvatarRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List getAvatarRequestDescriptor = $convert.base64Decode(+ 'ChBHZXRBdmF0YXJSZXF1ZXN0EhsKCWRldmljZV9pZBgBIAEoCVIIZGV2aWNlSWQ=');++@$core.Deprecated('Use avatarDescriptor instead')+const Avatar$json = {+ '1': 'Avatar',+ '2': [+ {'1': 'jpeg', '3': 1, '4': 1, '5': 12, '10': 'jpeg'},+ {'1': 'avatar_hash', '3': 2, '4': 1, '5': 12, '10': 'avatarHash'},+ ],+};++/// Descriptor for `Avatar`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List avatarDescriptor = $convert.base64Decode(+ 'CgZBdmF0YXISEgoEanBlZxgBIAEoDFIEanBlZxIfCgthdmF0YXJfaGFzaBgCIAEoDFIKYXZhdG'+ 'FySGFzaA==');++@$core.Deprecated('Use friendRefDescriptor instead')+const FriendRef$json = {+ '1': 'FriendRef',+ '2': [+ {'1': 'device_id', '3': 1, '4': 1, '5': 9, '10': 'deviceId'},+ ],+};++/// Descriptor for `FriendRef`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List friendRefDescriptor = $convert+ .base64Decode('CglGcmllbmRSZWYSGwoJZGV2aWNlX2lkGAEgASgJUghkZXZpY2VJZA==');++@$core.Deprecated('Use setFriendAutoAcceptRequestDescriptor instead')+const SetFriendAutoAcceptRequest$json = {+ '1': 'SetFriendAutoAcceptRequest',+ '2': [+ {'1': 'device_id', '3': 1, '4': 1, '5': 9, '10': 'deviceId'},+ {'1': 'auto_accept', '3': 2, '4': 1, '5': 8, '10': 'autoAccept'},+ ],+};++/// Descriptor for `SetFriendAutoAcceptRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List setFriendAutoAcceptRequestDescriptor =+ $convert.base64Decode(+ 'ChpTZXRGcmllbmRBdXRvQWNjZXB0UmVxdWVzdBIbCglkZXZpY2VfaWQYASABKAlSCGRldmljZU'+ 'lkEh8KC2F1dG9fYWNjZXB0GAIgASgIUgphdXRvQWNjZXB0');++@$core.Deprecated('Use friendDescriptor instead')+const Friend$json = {+ '1': 'Friend',+ '2': [+ {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},+ {'1': 'display_name', '3': 2, '4': 1, '5': 9, '10': 'displayName'},+ {'1': 'device_name', '3': 3, '4': 1, '5': 9, '10': 'deviceName'},+ {'1': 'platform', '3': 4, '4': 1, '5': 9, '10': 'platform'},+ {'1': 'online', '3': 5, '4': 1, '5': 8, '10': 'online'},+ {+ '1': 'connection',+ '3': 6,+ '4': 1,+ '5': 14,+ '6': '.pasteferry.v1.ConnectionKind',+ '10': 'connection'+ },+ {'1': 'lan_reachable', '3': 7, '4': 1, '5': 8, '10': 'lanReachable'},+ {'1': 'features_known', '3': 8, '4': 1, '5': 8, '10': 'featuresKnown'},+ {'1': 'receives_files', '3': 9, '4': 1, '5': 8, '10': 'receivesFiles'},+ {'1': 'receive_disabled', '3': 10, '4': 1, '5': 8, '10': 'receiveDisabled'},+ {'1': 'app_version', '3': 11, '4': 1, '5': 9, '10': 'appVersion'},+ {'1': 'auto_accept', '3': 12, '4': 1, '5': 8, '10': 'autoAccept'},+ {'1': 'added_at_unix', '3': 13, '4': 1, '5': 3, '10': 'addedAtUnix'},+ {+ '1': 'last_activity_unix',+ '3': 14,+ '4': 1,+ '5': 3,+ '10': 'lastActivityUnix'+ },+ {'1': 'reachability', '3': 15, '4': 1, '5': 9, '10': 'reachability'},+ {'1': 'has_avatar', '3': 16, '4': 1, '5': 8, '10': 'hasAvatar'},+ {'1': 'avatar_hash', '3': 17, '4': 1, '5': 12, '10': 'avatarHash'},+ {'1': 'fingerprint', '3': 18, '4': 1, '5': 9, '10': 'fingerprint'},+ ],+};++/// Descriptor for `Friend`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List friendDescriptor = $convert.base64Decode(+ 'CgZGcmllbmQSDgoCaWQYASABKAlSAmlkEiEKDGRpc3BsYXlfbmFtZRgCIAEoCVILZGlzcGxheU'+ '5hbWUSHwoLZGV2aWNlX25hbWUYAyABKAlSCmRldmljZU5hbWUSGgoIcGxhdGZvcm0YBCABKAlS'+ 'CHBsYXRmb3JtEhYKBm9ubGluZRgFIAEoCFIGb25saW5lEj0KCmNvbm5lY3Rpb24YBiABKA4yHS'+ '5wYXN0ZWZlcnJ5LnYxLkNvbm5lY3Rpb25LaW5kUgpjb25uZWN0aW9uEiMKDWxhbl9yZWFjaGFi'+ 'bGUYByABKAhSDGxhblJlYWNoYWJsZRIlCg5mZWF0dXJlc19rbm93bhgIIAEoCFINZmVhdHVyZX'+ 'NLbm93bhIlCg5yZWNlaXZlc19maWxlcxgJIAEoCFINcmVjZWl2ZXNGaWxlcxIpChByZWNlaXZl'+ 'X2Rpc2FibGVkGAogASgIUg9yZWNlaXZlRGlzYWJsZWQSHwoLYXBwX3ZlcnNpb24YCyABKAlSCm'+ 'FwcFZlcnNpb24SHwoLYXV0b19hY2NlcHQYDCABKAhSCmF1dG9BY2NlcHQSIgoNYWRkZWRfYXRf'+ 'dW5peBgNIAEoA1ILYWRkZWRBdFVuaXgSLAoSbGFzdF9hY3Rpdml0eV91bml4GA4gASgDUhBsYX'+ 'N0QWN0aXZpdHlVbml4EiIKDHJlYWNoYWJpbGl0eRgPIAEoCVIMcmVhY2hhYmlsaXR5Eh0KCmhh'+ 'c19hdmF0YXIYECABKAhSCWhhc0F2YXRhchIfCgthdmF0YXJfaGFzaBgRIAEoDFIKYXZhdGFySG'+ 'FzaBIgCgtmaW5nZXJwcmludBgSIAEoCVILZmluZ2VycHJpbnQ=');++@$core.Deprecated('Use listFriendsResponseDescriptor instead')+const ListFriendsResponse$json = {+ '1': 'ListFriendsResponse',+ '2': [+ {+ '1': 'friends',+ '3': 1,+ '4': 3,+ '5': 11,+ '6': '.pasteferry.v1.Friend',+ '10': 'friends'+ },+ ],+};++/// Descriptor for `ListFriendsResponse`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List listFriendsResponseDescriptor = $convert.base64Decode(+ 'ChNMaXN0RnJpZW5kc1Jlc3BvbnNlEi8KB2ZyaWVuZHMYASADKAsyFS5wYXN0ZWZlcnJ5LnYxLk'+ 'ZyaWVuZFIHZnJpZW5kcw==');++@$core.Deprecated('Use friendRequestDescriptor instead')+const FriendRequest$json = {+ '1': 'FriendRequest',+ '2': [+ {'1': 'session', '3': 1, '4': 1, '5': 9, '10': 'session'},+ {'1': 'device_id', '3': 2, '4': 1, '5': 9, '10': 'deviceId'},+ {'1': 'display_name', '3': 3, '4': 1, '5': 9, '10': 'displayName'},+ {'1': 'device_name', '3': 4, '4': 1, '5': 9, '10': 'deviceName'},+ {'1': 'platform', '3': 5, '4': 1, '5': 9, '10': 'platform'},+ {'1': 'fingerprint', '3': 6, '4': 1, '5': 9, '10': 'fingerprint'},+ {'1': 'self_fingerprint', '3': 7, '4': 1, '5': 9, '10': 'selfFingerprint'},+ ],+};++/// Descriptor for `FriendRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List friendRequestDescriptor = $convert.base64Decode(+ 'Cg1GcmllbmRSZXF1ZXN0EhgKB3Nlc3Npb24YASABKAlSB3Nlc3Npb24SGwoJZGV2aWNlX2lkGA'+ 'IgASgJUghkZXZpY2VJZBIhCgxkaXNwbGF5X25hbWUYAyABKAlSC2Rpc3BsYXlOYW1lEh8KC2Rl'+ 'dmljZV9uYW1lGAQgASgJUgpkZXZpY2VOYW1lEhoKCHBsYXRmb3JtGAUgASgJUghwbGF0Zm9ybR'+ 'IgCgtmaW5nZXJwcmludBgGIAEoCVILZmluZ2VycHJpbnQSKQoQc2VsZl9maW5nZXJwcmludBgH'+ 'IAEoCVIPc2VsZkZpbmdlcnByaW50');++@$core.Deprecated('Use strangerDescriptor instead')+const Stranger$json = {+ '1': 'Stranger',+ '2': [+ {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},+ {'1': 'display_name', '3': 2, '4': 1, '5': 9, '10': 'displayName'},+ {'1': 'device_name', '3': 3, '4': 1, '5': 9, '10': 'deviceName'},+ {'1': 'platform', '3': 4, '4': 1, '5': 9, '10': 'platform'},+ {'1': 'receives_files', '3': 5, '4': 1, '5': 8, '10': 'receivesFiles'},+ ],+};++/// Descriptor for `Stranger`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List strangerDescriptor = $convert.base64Decode(+ 'CghTdHJhbmdlchIOCgJpZBgBIAEoCVICaWQSIQoMZGlzcGxheV9uYW1lGAIgASgJUgtkaXNwbG'+ 'F5TmFtZRIfCgtkZXZpY2VfbmFtZRgDIAEoCVIKZGV2aWNlTmFtZRIaCghwbGF0Zm9ybRgEIAEo'+ 'CVIIcGxhdGZvcm0SJQoOcmVjZWl2ZXNfZmlsZXMYBSABKAhSDXJlY2VpdmVzRmlsZXM=');++@$core.Deprecated('Use strangersDescriptor instead')+const Strangers$json = {+ '1': 'Strangers',+ '2': [+ {+ '1': 'strangers',+ '3': 1,+ '4': 3,+ '5': 11,+ '6': '.pasteferry.v1.Stranger',+ '10': 'strangers'+ },+ ],+};++/// Descriptor for `Strangers`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List strangersDescriptor = $convert.base64Decode(+ 'CglTdHJhbmdlcnMSNQoJc3RyYW5nZXJzGAEgAygLMhcucGFzdGVmZXJyeS52MS5TdHJhbmdlcl'+ 'IJc3RyYW5nZXJz');@$core.Deprecated('Use notificationStatusDescriptor instead')const NotificationStatus$json = {@@ -1019,6 +1293,15 @@ const Config$json = {'5': 9,'10': 'syncDisabledPeers'},+ {'1': 'receive_from', '3': 30, '4': 1, '5': 9, '10': 'receiveFrom'},+ {+ '1': 'everyone_until_unix',+ '3': 31,+ '4': 1,+ '5': 3,+ '10': 'everyoneUntilUnix'+ },+ {'1': 'display_name', '3': 32, '4': 1, '5': 9, '10': 'displayName'},],};@@ -1046,7 +1329,9 @@ final $typed_data.Uint8List configDescriptor = $convert.base64Decode('ABKAhSFXJlY2VpdmVOb3RpZnlEaXNhYmxlZBIuChNzZW5kX2xheW91dF9zdGFja2VkGBogASgI''UhFzZW5kTGF5b3V0U3RhY2tlZBI0ChZyZWFsdGltZV9zeW5jX2Rpc2FibGVkGBsgASgIUhRyZW''FsdGltZVN5bmNEaXNhYmxlZBIhCgxzeW5jX2JhY2tsb2cYHCABKAhSC3N5bmNCYWNrbG9nEi4K'- 'E3N5bmNfZGlzYWJsZWRfcGVlcnMYHSADKAlSEXN5bmNEaXNhYmxlZFBlZXJz');+ 'E3N5bmNfZGlzYWJsZWRfcGVlcnMYHSADKAlSEXN5bmNEaXNhYmxlZFBlZXJzEiEKDHJlY2Vpdm'+ 'VfZnJvbRgeIAEoCVILcmVjZWl2ZUZyb20SLgoTZXZlcnlvbmVfdW50aWxfdW5peBgfIAEoA1IR'+ 'ZXZlcnlvbmVVbnRpbFVuaXgSIQoMZGlzcGxheV9uYW1lGCAgASgJUgtkaXNwbGF5TmFtZQ==');@$core.Deprecated('Use officialUsageDescriptor instead')const OfficialUsage$json = {@@ -1449,13 +1734,15 @@ const SendFilesRequest$json = {{'1': 'device_id', '3': 1, '4': 1, '5': 9, '10': 'deviceId'},{'1': 'paths', '3': 2, '4': 3, '5': 9, '10': 'paths'},{'1': 'allow_relay', '3': 3, '4': 1, '5': 8, '10': 'allowRelay'},+ {'1': 'note', '3': 4, '4': 1, '5': 9, '10': 'note'},],};/// Descriptor for `SendFilesRequest`. Decode as a `google.protobuf.DescriptorProto`.final $typed_data.Uint8List sendFilesRequestDescriptor = $convert.base64Decode('ChBTZW5kRmlsZXNSZXF1ZXN0EhsKCWRldmljZV9pZBgBIAEoCVIIZGV2aWNlSWQSFAoFcGF0aH'- 'MYAiADKAlSBXBhdGhzEh8KC2FsbG93X3JlbGF5GAMgASgIUgphbGxvd1JlbGF5');+ 'MYAiADKAlSBXBhdGhzEh8KC2FsbG93X3JlbGF5GAMgASgIUgphbGxvd1JlbGF5EhIKBG5vdGUY'+ 'BCABKAlSBG5vdGU=');@$core.Deprecated('Use transferRefDescriptor instead')const TransferRef$json = {@@ -1509,6 +1796,9 @@ const Transfer$json = {{'1': 'current_index', '3': 20, '4': 1, '5': 3, '10': 'currentIndex'},{'1': 'present', '3': 21, '4': 3, '5': 8, '10': 'present'},{'1': 'renamed_files', '3': 22, '4': 1, '5': 3, '10': 'renamedFiles'},+ {'1': 'peer_role', '3': 23, '4': 1, '5': 9, '10': 'peerRole'},+ {'1': 'note', '3': 24, '4': 1, '5': 9, '10': 'note'},+ {'1': 'thumbs', '3': 25, '4': 3, '5': 9, '10': 'thumbs'},],};@@ -1527,7 +1817,23 @@ final $typed_data.Uint8List transferDescriptor = $convert.base64Decode('KANSDmZpbmlzaGVkQXRVbml4EiMKDXNjYW5uZWRfZmlsZXMYEiABKANSDHNjYW5uZWRGaWxlcx''IhCgxjdXJyZW50X2ZpbGUYEyABKAlSC2N1cnJlbnRGaWxlEiMKDWN1cnJlbnRfaW5kZXgYFCAB''KANSDGN1cnJlbnRJbmRleBIYCgdwcmVzZW50GBUgAygIUgdwcmVzZW50EiMKDXJlbmFtZWRfZm'- 'lsZXMYFiABKANSDHJlbmFtZWRGaWxlcw==');+ 'lsZXMYFiABKANSDHJlbmFtZWRGaWxlcxIbCglwZWVyX3JvbGUYFyABKAlSCHBlZXJSb2xlEhIK'+ 'BG5vdGUYGCABKAlSBG5vdGUSFgoGdGh1bWJzGBkgAygJUgZ0aHVtYnM=');++@$core.Deprecated('Use answerIncomingRequestDescriptor instead')+const AnswerIncomingRequest$json = {+ '1': 'AnswerIncomingRequest',+ '2': [+ {'1': 'transfer_id', '3': 1, '4': 1, '5': 9, '10': 'transferId'},+ {'1': 'accept', '3': 2, '4': 1, '5': 8, '10': 'accept'},+ {'1': 'always', '3': 3, '4': 1, '5': 8, '10': 'always'},+ ],+};++/// Descriptor for `AnswerIncomingRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List answerIncomingRequestDescriptor = $convert.base64Decode(+ 'ChVBbnN3ZXJJbmNvbWluZ1JlcXVlc3QSHwoLdHJhbnNmZXJfaWQYASABKAlSCnRyYW5zZmVySW'+ 'QSFgoGYWNjZXB0GAIgASgIUgZhY2NlcHQSFgoGYWx3YXlzGAMgASgIUgZhbHdheXM=');@$core.Deprecated('Use listTransfersRequestDescriptor instead')const ListTransfersRequest$json = {diff --git a/ui/lib/gen/pasteferry/v1/wire.pb.dart b/ui/lib/gen/pasteferry/v1/wire.pb.dartindex 98c8465..32e7d04 100644--- a/ui/lib/gen/pasteferry/v1/wire.pb.dart+++ b/ui/lib/gen/pasteferry/v1/wire.pb.dart@@ -112,6 +112,10 @@ enum SignalMessage_Payload {ping,lanHello,retryDirect,+ pairIntent,+ friendConfirm,+ strangerHello,+ friendRemove,notSet}@@ -130,6 +134,10 @@ class SignalMessage extends $pb.GeneratedMessage {Ping? ping,LanHello? lanHello,RetryDirect? retryDirect,+ PairIntent? pairIntent,+ FriendConfirm? friendConfirm,+ StrangerHello? strangerHello,+ FriendRemove? friendRemove,}) {final result = SignalMessage._();if (timestampUnix != null) result.timestampUnix = timestampUnix;@@ -146,6 +154,10 @@ class SignalMessage extends $pb.GeneratedMessage {if (ping != null) result.ping = ping;if (lanHello != null) result.lanHello = lanHello;if (retryDirect != null) result.retryDirect = retryDirect;+ if (pairIntent != null) result.pairIntent = pairIntent;+ if (friendConfirm != null) result.friendConfirm = friendConfirm;+ if (strangerHello != null) result.strangerHello = strangerHello;+ if (friendRemove != null) result.friendRemove = friendRemove;return result;}@@ -166,13 +178,17 @@ class SignalMessage extends $pb.GeneratedMessage {13: SignalMessage_Payload.ping,14: SignalMessage_Payload.lanHello,15: SignalMessage_Payload.retryDirect,+ 16: SignalMessage_Payload.pairIntent,+ 17: SignalMessage_Payload.friendConfirm,+ 18: SignalMessage_Payload.strangerHello,+ 19: SignalMessage_Payload.friendRemove,0: SignalMessage_Payload.notSet};static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SignalMessage',package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),createEmptyInstance: SignalMessage.$_createMessage)- ..oo(0, [10, 11, 12, 13, 14, 15])+ ..oo(0, [10, 11, 12, 13, 14, 15, 16, 17, 18, 19])..aInt64(1, _omitFieldNames ? '' : 'timestampUnix')..a<$core.List<$core.int>>(2, _omitFieldNames ? '' : 'nonce', $pb.PbFieldType.OY)@@ -193,6 +209,14 @@ class SignalMessage extends $pb.GeneratedMessage {subBuilder: LanHello.$_createMessage)..aOM<RetryDirect>(15, _omitFieldNames ? '' : 'retryDirect',subBuilder: RetryDirect.$_createMessage)+ ..aOM<PairIntent>(16, _omitFieldNames ? '' : 'pairIntent',+ subBuilder: PairIntent.$_createMessage)+ ..aOM<FriendConfirm>(17, _omitFieldNames ? '' : 'friendConfirm',+ subBuilder: FriendConfirm.$_createMessage)+ ..aOM<StrangerHello>(18, _omitFieldNames ? '' : 'strangerHello',+ subBuilder: StrangerHello.$_createMessage)+ ..aOM<FriendRemove>(19, _omitFieldNames ? '' : 'friendRemove',+ subBuilder: FriendRemove.$_createMessage)..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -223,6 +247,10 @@ class SignalMessage extends $pb.GeneratedMessage {@$pb.TagNumber(13)@$pb.TagNumber(14)@$pb.TagNumber(15)+ @$pb.TagNumber(16)+ @$pb.TagNumber(17)+ @$pb.TagNumber(18)+ @$pb.TagNumber(19)SignalMessage_Payload whichPayload() =>_SignalMessage_PayloadByTag[$_whichOneof(0)]!;@$pb.TagNumber(10)@@ -231,6 +259,10 @@ class SignalMessage extends $pb.GeneratedMessage {@$pb.TagNumber(13)@$pb.TagNumber(14)@$pb.TagNumber(15)+ @$pb.TagNumber(16)+ @$pb.TagNumber(17)+ @$pb.TagNumber(18)+ @$pb.TagNumber(19)void clearPayload() => $_clearField($_whichOneof(0));/// 防重放:接收方拒绝时间戳过旧或 nonce 重复的消息@@ -365,6 +397,257 @@ class SignalMessage extends $pb.GeneratedMessage {void clearRetryDirect() => $_clearField(15);@$pb.TagNumber(15)RetryDirect ensureRetryDirect() => $_ensure(12);++ /// 配对码兑换后、用户确认前,两边告诉对方这次是配对还是加好友(2.6.0)。+ /// 旧版本不发:没收到就当作配对+ @$pb.TagNumber(16)+ PairIntent get pairIntent => $_getN(13);+ @$pb.TagNumber(16)+ set pairIntent(PairIntent value) => $_setField(16, value);+ @$pb.TagNumber(16)+ $core.bool hasPairIntent() => $_has(13);+ @$pb.TagNumber(16)+ void clearPairIntent() => $_clearField(16);+ @$pb.TagNumber(16)+ PairIntent ensurePairIntent() => $_ensure(13);++ /// 加好友:本端的用户点了「添加」或「取消」。两边都添加了才算好友+ @$pb.TagNumber(17)+ FriendConfirm get friendConfirm => $_getN(14);+ @$pb.TagNumber(17)+ set friendConfirm(FriendConfirm value) => $_setField(17, value);+ @$pb.TagNumber(17)+ $core.bool hasFriendConfirm() => $_has(14);+ @$pb.TagNumber(17)+ void clearFriendConfirm() => $_clearField(17);+ @$pb.TagNumber(17)+ FriendConfirm ensureFriendConfirm() => $_ensure(14);++ /// 「所有人」模式下陌生设备之间交换的名片,见 design/friends-send.md 第 9.1 节+ @$pb.TagNumber(18)+ StrangerHello get strangerHello => $_getN(15);+ @$pb.TagNumber(18)+ set strangerHello(StrangerHello value) => $_setField(18, value);+ @$pb.TagNumber(18)+ $core.bool hasStrangerHello() => $_has(15);+ @$pb.TagNumber(18)+ void clearStrangerHello() => $_clearField(18);+ @$pb.TagNumber(18)+ StrangerHello ensureStrangerHello() => $_ensure(15);++ @$pb.TagNumber(19)+ FriendRemove get friendRemove => $_getN(16);+ @$pb.TagNumber(19)+ set friendRemove(FriendRemove value) => $_setField(19, value);+ @$pb.TagNumber(19)+ $core.bool hasFriendRemove() => $_has(16);+ @$pb.TagNumber(19)+ void clearFriendRemove() => $_clearField(19);+ @$pb.TagNumber(19)+ FriendRemove ensureFriendRemove() => $_ensure(16);+}++/// 配对码兑换后各自发一次,直到收到对方的。intent 是 "device"(配对)或 "friend"(加好友)+class PairIntent extends $pb.GeneratedMessage {+ factory PairIntent({+ $core.String? intent,+ FriendCard? card,+ }) {+ final result = PairIntent._();+ if (intent != null) result.intent = intent;+ if (card != null) result.card = card;+ return result;+ }++ PairIntent._();++ factory PairIntent.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ PairIntent()..mergeFromBuffer(data, registry);+ factory PairIntent.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ PairIntent()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'PairIntent',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: PairIntent.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'intent')+ ..aOM<FriendCard>(2, _omitFieldNames ? '' : 'card',+ subBuilder: FriendCard.$_createMessage)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ PairIntent clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ PairIntent copyWith(void Function(PairIntent) updates) =>+ super.copyWith((message) => updates(message as PairIntent)) as PairIntent;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use PairIntent() / PairIntent.new instead')+ static PairIntent create() => PairIntent._();+ static $pb.GeneratedMessage $_createMessage() => PairIntent._();+ @$core.override+ PairIntent createEmptyInstance() => PairIntent._();+ @$core.pragma('dart2js:noInline')+ static PairIntent getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<PairIntent>(PairIntent.$_createMessage);+ static PairIntent? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get intent => $_getSZ(0);+ @$pb.TagNumber(1)+ set intent($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasIntent() => $_has(0);+ @$pb.TagNumber(1)+ void clearIntent() => $_clearField(1);++ /// 加好友时带上名片,确认框里显示对方的名字+ @$pb.TagNumber(2)+ FriendCard get card => $_getN(1);+ @$pb.TagNumber(2)+ set card(FriendCard value) => $_setField(2, value);+ @$pb.TagNumber(2)+ $core.bool hasCard() => $_has(1);+ @$pb.TagNumber(2)+ void clearCard() => $_clearField(2);+ @$pb.TagNumber(2)+ FriendCard ensureCard() => $_ensure(1);+}++class FriendConfirm extends $pb.GeneratedMessage {+ factory FriendConfirm({+ $core.bool? accepted,+ }) {+ final result = FriendConfirm._();+ if (accepted != null) result.accepted = accepted;+ return result;+ }++ FriendConfirm._();++ factory FriendConfirm.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendConfirm()..mergeFromBuffer(data, registry);+ factory FriendConfirm.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendConfirm()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'FriendConfirm',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: FriendConfirm.$_createMessage)+ ..aOB(1, _omitFieldNames ? '' : 'accepted')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendConfirm clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendConfirm copyWith(void Function(FriendConfirm) updates) =>+ super.copyWith((message) => updates(message as FriendConfirm))+ as FriendConfirm;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use FriendConfirm() / FriendConfirm.new instead')+ static FriendConfirm create() => FriendConfirm._();+ static $pb.GeneratedMessage $_createMessage() => FriendConfirm._();+ @$core.override+ FriendConfirm createEmptyInstance() => FriendConfirm._();+ @$core.pragma('dart2js:noInline')+ static FriendConfirm getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<FriendConfirm>(+ FriendConfirm.$_createMessage);+ static FriendConfirm? _defaultInstance;++ @$pb.TagNumber(1)+ $core.bool get accepted => $_getBF(0);+ @$pb.TagNumber(1)+ set accepted($core.bool value) => $_setBool(0, value);+ @$pb.TagNumber(1)+ $core.bool hasAccepted() => $_has(0);+ @$pb.TagNumber(1)+ void clearAccepted() => $_clearField(1);+}++/// 「所有人」模式:发送方先发,接收方开着「所有人」时回一条(reply = true)。+/// 公钥随签名的局域网配对信息交换(见 LanPacket.stranger),这里只带显示用的名片+class StrangerHello extends $pb.GeneratedMessage {+ factory StrangerHello({+ FriendCard? card,+ $core.bool? reply,+ }) {+ final result = StrangerHello._();+ if (card != null) result.card = card;+ if (reply != null) result.reply = reply;+ return result;+ }++ StrangerHello._();++ factory StrangerHello.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ StrangerHello()..mergeFromBuffer(data, registry);+ factory StrangerHello.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ StrangerHello()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'StrangerHello',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: StrangerHello.$_createMessage)+ ..aOM<FriendCard>(1, _omitFieldNames ? '' : 'card',+ subBuilder: FriendCard.$_createMessage)+ ..aOB(2, _omitFieldNames ? '' : 'reply')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ StrangerHello clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ StrangerHello copyWith(void Function(StrangerHello) updates) =>+ super.copyWith((message) => updates(message as StrangerHello))+ as StrangerHello;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use StrangerHello() / StrangerHello.new instead')+ static StrangerHello create() => StrangerHello._();+ static $pb.GeneratedMessage $_createMessage() => StrangerHello._();+ @$core.override+ StrangerHello createEmptyInstance() => StrangerHello._();+ @$core.pragma('dart2js:noInline')+ static StrangerHello getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<StrangerHello>(+ StrangerHello.$_createMessage);+ static StrangerHello? _defaultInstance;++ @$pb.TagNumber(1)+ FriendCard get card => $_getN(0);+ @$pb.TagNumber(1)+ set card(FriendCard value) => $_setField(1, value);+ @$pb.TagNumber(1)+ $core.bool hasCard() => $_has(0);+ @$pb.TagNumber(1)+ void clearCard() => $_clearField(1);+ @$pb.TagNumber(1)+ FriendCard ensureCard() => $_ensure(0);++ @$pb.TagNumber(2)+ $core.bool get reply => $_getBF(1);+ @$pb.TagNumber(2)+ set reply($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasReply() => $_has(1);+ @$pb.TagNumber(2)+ void clearReply() => $_clearField(2);}/// 用户在应答方点了「重新连接」:只有发起方能做 ICE 重启,请它马上再试一次直连。@@ -1946,6 +2229,7 @@ enum LanPacket_Payload {pairReject,nearbyRequest,nearbyPing,+ strangerRequest,notSet}@@ -1957,6 +2241,7 @@ class LanPacket extends $pb.GeneratedMessage {LanPairReject? pairReject,LanPairSigned? nearbyRequest,LanNearbyPing? nearbyPing,+ LanPairSigned? strangerRequest,}) {final result = LanPacket._();if (signal != null) result.signal = signal;@@ -1965,6 +2250,7 @@ class LanPacket extends $pb.GeneratedMessage {if (pairReject != null) result.pairReject = pairReject;if (nearbyRequest != null) result.nearbyRequest = nearbyRequest;if (nearbyPing != null) result.nearbyPing = nearbyPing;+ if (strangerRequest != null) result.strangerRequest = strangerRequest;return result;}@@ -1985,13 +2271,14 @@ class LanPacket extends $pb.GeneratedMessage {4: LanPacket_Payload.pairReject,5: LanPacket_Payload.nearbyRequest,6: LanPacket_Payload.nearbyPing,+ 7: LanPacket_Payload.strangerRequest,0: LanPacket_Payload.notSet};static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'LanPacket',package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),createEmptyInstance: LanPacket.$_createMessage)- ..oo(0, [1, 2, 3, 4, 5, 6])+ ..oo(0, [1, 2, 3, 4, 5, 6, 7])..aOM<Signed>(1, _omitFieldNames ? '' : 'signal',subBuilder: Signed.$_createMessage)..aOM<LanPairSigned>(2, _omitFieldNames ? '' : 'pairRequest',@@ -2004,6 +2291,8 @@ class LanPacket extends $pb.GeneratedMessage {subBuilder: LanPairSigned.$_createMessage)..aOM<LanNearbyPing>(6, _omitFieldNames ? '' : 'nearbyPing',subBuilder: LanNearbyPing.$_createMessage)+ ..aOM<LanPairSigned>(7, _omitFieldNames ? '' : 'strangerRequest',+ subBuilder: LanPairSigned.$_createMessage)..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -2032,6 +2321,7 @@ class LanPacket extends $pb.GeneratedMessage {@$pb.TagNumber(4)@$pb.TagNumber(5)@$pb.TagNumber(6)+ @$pb.TagNumber(7)LanPacket_Payload whichPayload() => _LanPacket_PayloadByTag[$_whichOneof(0)]!;@$pb.TagNumber(1)@$pb.TagNumber(2)@@ -2039,6 +2329,7 @@ class LanPacket extends $pb.GeneratedMessage {@$pb.TagNumber(4)@$pb.TagNumber(5)@$pb.TagNumber(6)+ @$pb.TagNumber(7)void clearPayload() => $_clearField($_whichOneof(0));@$pb.TagNumber(1)@@ -2106,6 +2397,19 @@ class LanPacket extends $pb.GeneratedMessage {void clearNearbyPing() => $_clearField(6);@$pb.TagNumber(6)LanNearbyPing ensureNearbyPing() => $_ensure(5);++ /// 「所有人」模式(2.6.0):向开着「所有人」的陌生设备要它的公钥,以便给它发文件。+ /// 请求与回复都带名片(LanPairInfo.card),不带配对码+ @$pb.TagNumber(7)+ LanPairSigned get strangerRequest => $_getN(6);+ @$pb.TagNumber(7)+ set strangerRequest(LanPairSigned value) => $_setField(7, value);+ @$pb.TagNumber(7)+ $core.bool hasStrangerRequest() => $_has(6);+ @$pb.TagNumber(7)+ void clearStrangerRequest() => $_clearField(7);+ @$pb.TagNumber(7)+ LanPairSigned ensureStrangerRequest() => $_ensure(6);}/// 已配对设备之间的上线通知。还没连通时定期发,连通后低频保活。@@ -2282,6 +2586,8 @@ class LanPairInfo extends $pb.GeneratedMessage {$fixnum.Int64? timestampUnix,$core.List<$core.int>? nonce,$core.List<$core.int>? requestNonce,+ $core.String? intent,+ FriendCard? card,}) {final result = LanPairInfo._();if (code != null) result.code = code;@@ -2293,6 +2599,8 @@ class LanPairInfo extends $pb.GeneratedMessage {if (timestampUnix != null) result.timestampUnix = timestampUnix;if (nonce != null) result.nonce = nonce;if (requestNonce != null) result.requestNonce = requestNonce;+ if (intent != null) result.intent = intent;+ if (card != null) result.card = card;return result;}@@ -2321,6 +2629,9 @@ class LanPairInfo extends $pb.GeneratedMessage {8, _omitFieldNames ? '' : 'nonce', $pb.PbFieldType.OY)..a<$core.List<$core.int>>(9, _omitFieldNames ? '' : 'requestNonce', $pb.PbFieldType.OY)+ ..aOS(10, _omitFieldNames ? '' : 'intent')+ ..aOM<FriendCard>(11, _omitFieldNames ? '' : 'card',+ subBuilder: FriendCard.$_createMessage)..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -2419,6 +2730,29 @@ class LanPairInfo extends $pb.GeneratedMessage {$core.bool hasRequestNonce() => $_has(8);@$pb.TagNumber(9)void clearRequestNonce() => $_clearField(9);++ /// 这次是配对("device",旧版本不带)还是加好友("friend",2.6.0)。+ /// 显示码的一方发现与自己开放的不一致时回绝(intent_device / intent_friend),不用掉这个码+ @$pb.TagNumber(10)+ $core.String get intent => $_getSZ(9);+ @$pb.TagNumber(10)+ set intent($core.String value) => $_setString(9, value);+ @$pb.TagNumber(10)+ $core.bool hasIntent() => $_has(9);+ @$pb.TagNumber(10)+ void clearIntent() => $_clearField(10);++ /// 加好友时带上名片+ @$pb.TagNumber(11)+ FriendCard get card => $_getN(10);+ @$pb.TagNumber(11)+ set card(FriendCard value) => $_setField(11, value);+ @$pb.TagNumber(11)+ $core.bool hasCard() => $_has(10);+ @$pb.TagNumber(11)+ void clearCard() => $_clearField(11);+ @$pb.TagNumber(11)+ FriendCard ensureCard() => $_ensure(10);}class LanPairReject extends $pb.GeneratedMessage {@@ -2597,6 +2931,9 @@ enum PeerMessage_Payload {sendAnswer,sendCancel,sendResult,+ friendCard,+ avatarRequest,+ avatarData,notSet}@@ -2615,6 +2952,9 @@ class PeerMessage extends $pb.GeneratedMessage {SendAnswer? sendAnswer,SendCancel? sendCancel,SendResult? sendResult,+ FriendCard? friendCard,+ AvatarRequest? avatarRequest,+ AvatarData? avatarData,}) {final result = PeerMessage._();if (offer != null) result.offer = offer;@@ -2629,6 +2969,9 @@ class PeerMessage extends $pb.GeneratedMessage {if (sendAnswer != null) result.sendAnswer = sendAnswer;if (sendCancel != null) result.sendCancel = sendCancel;if (sendResult != null) result.sendResult = sendResult;+ if (friendCard != null) result.friendCard = friendCard;+ if (avatarRequest != null) result.avatarRequest = avatarRequest;+ if (avatarData != null) result.avatarData = avatarData;return result;}@@ -2655,13 +2998,16 @@ class PeerMessage extends $pb.GeneratedMessage {10: PeerMessage_Payload.sendAnswer,11: PeerMessage_Payload.sendCancel,12: PeerMessage_Payload.sendResult,+ 13: PeerMessage_Payload.friendCard,+ 14: PeerMessage_Payload.avatarRequest,+ 15: PeerMessage_Payload.avatarData,0: PeerMessage_Payload.notSet};static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PeerMessage',package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),createEmptyInstance: PeerMessage.$_createMessage)- ..oo(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])+ ..oo(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])..aOM<ClipOffer>(1, _omitFieldNames ? '' : 'offer',subBuilder: ClipOffer.$_createMessage)..aOM<PeerFetch>(2, _omitFieldNames ? '' : 'fetch',@@ -2686,6 +3032,12 @@ class PeerMessage extends $pb.GeneratedMessage {subBuilder: SendCancel.$_createMessage)..aOM<SendResult>(12, _omitFieldNames ? '' : 'sendResult',subBuilder: SendResult.$_createMessage)+ ..aOM<FriendCard>(13, _omitFieldNames ? '' : 'friendCard',+ subBuilder: FriendCard.$_createMessage)+ ..aOM<AvatarRequest>(14, _omitFieldNames ? '' : 'avatarRequest',+ subBuilder: AvatarRequest.$_createMessage)+ ..aOM<AvatarData>(15, _omitFieldNames ? '' : 'avatarData',+ subBuilder: AvatarData.$_createMessage)..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -2722,6 +3074,9 @@ class PeerMessage extends $pb.GeneratedMessage {@$pb.TagNumber(10)@$pb.TagNumber(11)@$pb.TagNumber(12)+ @$pb.TagNumber(13)+ @$pb.TagNumber(14)+ @$pb.TagNumber(15)PeerMessage_Payload whichPayload() =>_PeerMessage_PayloadByTag[$_whichOneof(0)]!;@$pb.TagNumber(1)@@ -2736,6 +3091,9 @@ class PeerMessage extends $pb.GeneratedMessage {@$pb.TagNumber(10)@$pb.TagNumber(11)@$pb.TagNumber(12)+ @$pb.TagNumber(13)+ @$pb.TagNumber(14)+ @$pb.TagNumber(15)void clearPayload() => $_clearField($_whichOneof(0));@$pb.TagNumber(1)@@ -2870,6 +3228,359 @@ class PeerMessage extends $pb.GeneratedMessage {void clearSendResult() => $_clearField(12);@$pb.TagNumber(12)SendResult ensureSendResult() => $_ensure(11);++ /// 好友(2.6.0):连上后各自发一次名片;名片里的头像哈希变了才要头像+ @$pb.TagNumber(13)+ FriendCard get friendCard => $_getN(12);+ @$pb.TagNumber(13)+ set friendCard(FriendCard value) => $_setField(13, value);+ @$pb.TagNumber(13)+ $core.bool hasFriendCard() => $_has(12);+ @$pb.TagNumber(13)+ void clearFriendCard() => $_clearField(13);+ @$pb.TagNumber(13)+ FriendCard ensureFriendCard() => $_ensure(12);++ @$pb.TagNumber(14)+ AvatarRequest get avatarRequest => $_getN(13);+ @$pb.TagNumber(14)+ set avatarRequest(AvatarRequest value) => $_setField(14, value);+ @$pb.TagNumber(14)+ $core.bool hasAvatarRequest() => $_has(13);+ @$pb.TagNumber(14)+ void clearAvatarRequest() => $_clearField(14);+ @$pb.TagNumber(14)+ AvatarRequest ensureAvatarRequest() => $_ensure(13);++ @$pb.TagNumber(15)+ AvatarData get avatarData => $_getN(14);+ @$pb.TagNumber(15)+ set avatarData(AvatarData value) => $_setField(15, value);+ @$pb.TagNumber(15)+ $core.bool hasAvatarData() => $_has(14);+ @$pb.TagNumber(15)+ void clearAvatarData() => $_clearField(15);+ @$pb.TagNumber(15)+ AvatarData ensureAvatarData() => $_ensure(14);+}++/// 好友看到的本机信息。只在加密通道里、发给好友或陌生设备+class FriendCard extends $pb.GeneratedMessage {+ factory FriendCard({+ $core.String? displayName,+ $core.String? deviceName,+ $core.String? platform,+ $core.String? service,+ $core.List<$core.int>? customServerHash,+ $core.List<$core.int>? avatarHash,+ }) {+ final result = FriendCard._();+ if (displayName != null) result.displayName = displayName;+ if (deviceName != null) result.deviceName = deviceName;+ if (platform != null) result.platform = platform;+ if (service != null) result.service = service;+ if (customServerHash != null) result.customServerHash = customServerHash;+ if (avatarHash != null) result.avatarHash = avatarHash;+ return result;+ }++ FriendCard._();++ factory FriendCard.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendCard()..mergeFromBuffer(data, registry);+ factory FriendCard.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendCard()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'FriendCard',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: FriendCard.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'displayName')+ ..aOS(2, _omitFieldNames ? '' : 'deviceName')+ ..aOS(3, _omitFieldNames ? '' : 'platform')+ ..aOS(4, _omitFieldNames ? '' : 'service')+ ..a<$core.List<$core.int>>(+ 5, _omitFieldNames ? '' : 'customServerHash', $pb.PbFieldType.OY)+ ..a<$core.List<$core.int>>(+ 6, _omitFieldNames ? '' : 'avatarHash', $pb.PbFieldType.OY)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendCard clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendCard copyWith(void Function(FriendCard) updates) =>+ super.copyWith((message) => updates(message as FriendCard)) as FriendCard;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use FriendCard() / FriendCard.new instead')+ static FriendCard create() => FriendCard._();+ static $pb.GeneratedMessage $_createMessage() => FriendCard._();+ @$core.override+ FriendCard createEmptyInstance() => FriendCard._();+ @$core.pragma('dart2js:noInline')+ static FriendCard getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<FriendCard>(FriendCard.$_createMessage);+ static FriendCard? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get displayName => $_getSZ(0);+ @$pb.TagNumber(1)+ set displayName($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasDisplayName() => $_has(0);+ @$pb.TagNumber(1)+ void clearDisplayName() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.String get deviceName => $_getSZ(1);+ @$pb.TagNumber(2)+ set deviceName($core.String value) => $_setString(1, value);+ @$pb.TagNumber(2)+ $core.bool hasDeviceName() => $_has(1);+ @$pb.TagNumber(2)+ void clearDeviceName() => $_clearField(2);++ @$pb.TagNumber(3)+ $core.String get platform => $_getSZ(2);+ @$pb.TagNumber(3)+ set platform($core.String value) => $_setString(2, value);+ @$pb.TagNumber(3)+ $core.bool hasPlatform() => $_has(2);+ @$pb.TagNumber(3)+ void clearPlatform() => $_clearField(3);++ /// 本机用的是哪种服务:official / custom / lan,判断两边能不能跨网络找到对方+ @$pb.TagNumber(4)+ $core.String get service => $_getSZ(3);+ @$pb.TagNumber(4)+ set service($core.String value) => $_setString(3, value);+ @$pb.TagNumber(4)+ $core.bool hasService() => $_has(3);+ @$pb.TagNumber(4)+ void clearService() => $_clearField(4);++ /// 自建服务器地址的哈希(SHA-256 的前 16 字节),判断是不是同一台;不带地址本身+ @$pb.TagNumber(5)+ $core.List<$core.int> get customServerHash => $_getN(4);+ @$pb.TagNumber(5)+ set customServerHash($core.List<$core.int> value) => $_setBytes(4, value);+ @$pb.TagNumber(5)+ $core.bool hasCustomServerHash() => $_has(4);+ @$pb.TagNumber(5)+ void clearCustomServerHash() => $_clearField(5);++ /// 头像的哈希,空表示用默认头像+ @$pb.TagNumber(6)+ $core.List<$core.int> get avatarHash => $_getN(5);+ @$pb.TagNumber(6)+ set avatarHash($core.List<$core.int> value) => $_setBytes(5, value);+ @$pb.TagNumber(6)+ $core.bool hasAvatarHash() => $_has(5);+ @$pb.TagNumber(6)+ void clearAvatarHash() => $_clearField(6);+}++/// 删除好友。走签名的信令(不用先建 P2P 连接);收到的一方删掉后回一条 ack = true,+/// 发出的一方收到回执才不再补发+class FriendRemove extends $pb.GeneratedMessage {+ factory FriendRemove({+ $fixnum.Int64? atUnix,+ $core.bool? ack,+ }) {+ final result = FriendRemove._();+ if (atUnix != null) result.atUnix = atUnix;+ if (ack != null) result.ack = ack;+ return result;+ }++ FriendRemove._();++ factory FriendRemove.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendRemove()..mergeFromBuffer(data, registry);+ factory FriendRemove.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ FriendRemove()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'FriendRemove',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: FriendRemove.$_createMessage)+ ..aInt64(1, _omitFieldNames ? '' : 'atUnix')+ ..aOB(2, _omitFieldNames ? '' : 'ack')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendRemove clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ FriendRemove copyWith(void Function(FriendRemove) updates) =>+ super.copyWith((message) => updates(message as FriendRemove))+ as FriendRemove;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use FriendRemove() / FriendRemove.new instead')+ static FriendRemove create() => FriendRemove._();+ static $pb.GeneratedMessage $_createMessage() => FriendRemove._();+ @$core.override+ FriendRemove createEmptyInstance() => FriendRemove._();+ @$core.pragma('dart2js:noInline')+ static FriendRemove getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<FriendRemove>(+ FriendRemove.$_createMessage);+ static FriendRemove? _defaultInstance;++ @$pb.TagNumber(1)+ $fixnum.Int64 get atUnix => $_getI64(0);+ @$pb.TagNumber(1)+ set atUnix($fixnum.Int64 value) => $_setInt64(0, value);+ @$pb.TagNumber(1)+ $core.bool hasAtUnix() => $_has(0);+ @$pb.TagNumber(1)+ void clearAtUnix() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.bool get ack => $_getBF(1);+ @$pb.TagNumber(2)+ set ack($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasAck() => $_has(1);+ @$pb.TagNumber(2)+ void clearAck() => $_clearField(2);+}++class AvatarRequest extends $pb.GeneratedMessage {+ factory AvatarRequest({+ $core.List<$core.int>? avatarHash,+ }) {+ final result = AvatarRequest._();+ if (avatarHash != null) result.avatarHash = avatarHash;+ return result;+ }++ AvatarRequest._();++ factory AvatarRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ AvatarRequest()..mergeFromBuffer(data, registry);+ factory AvatarRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ AvatarRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'AvatarRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: AvatarRequest.$_createMessage)+ ..a<$core.List<$core.int>>(+ 1, _omitFieldNames ? '' : 'avatarHash', $pb.PbFieldType.OY)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ AvatarRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ AvatarRequest copyWith(void Function(AvatarRequest) updates) =>+ super.copyWith((message) => updates(message as AvatarRequest))+ as AvatarRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use AvatarRequest() / AvatarRequest.new instead')+ static AvatarRequest create() => AvatarRequest._();+ static $pb.GeneratedMessage $_createMessage() => AvatarRequest._();+ @$core.override+ AvatarRequest createEmptyInstance() => AvatarRequest._();+ @$core.pragma('dart2js:noInline')+ static AvatarRequest getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<AvatarRequest>(+ AvatarRequest.$_createMessage);+ static AvatarRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.List<$core.int> get avatarHash => $_getN(0);+ @$pb.TagNumber(1)+ set avatarHash($core.List<$core.int> value) => $_setBytes(0, value);+ @$pb.TagNumber(1)+ $core.bool hasAvatarHash() => $_has(0);+ @$pb.TagNumber(1)+ void clearAvatarHash() => $_clearField(1);+}++class AvatarData extends $pb.GeneratedMessage {+ factory AvatarData({+ $core.List<$core.int>? avatarHash,+ $core.List<$core.int>? jpeg,+ }) {+ final result = AvatarData._();+ if (avatarHash != null) result.avatarHash = avatarHash;+ if (jpeg != null) result.jpeg = jpeg;+ return result;+ }++ AvatarData._();++ factory AvatarData.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ AvatarData()..mergeFromBuffer(data, registry);+ factory AvatarData.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ AvatarData()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'AvatarData',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: AvatarData.$_createMessage)+ ..a<$core.List<$core.int>>(+ 1, _omitFieldNames ? '' : 'avatarHash', $pb.PbFieldType.OY)+ ..a<$core.List<$core.int>>(+ 2, _omitFieldNames ? '' : 'jpeg', $pb.PbFieldType.OY)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ AvatarData clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ AvatarData copyWith(void Function(AvatarData) updates) =>+ super.copyWith((message) => updates(message as AvatarData)) as AvatarData;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use AvatarData() / AvatarData.new instead')+ static AvatarData create() => AvatarData._();+ static $pb.GeneratedMessage $_createMessage() => AvatarData._();+ @$core.override+ AvatarData createEmptyInstance() => AvatarData._();+ @$core.pragma('dart2js:noInline')+ static AvatarData getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<AvatarData>(AvatarData.$_createMessage);+ static AvatarData? _defaultInstance;++ @$pb.TagNumber(1)+ $core.List<$core.int> get avatarHash => $_getN(0);+ @$pb.TagNumber(1)+ set avatarHash($core.List<$core.int> value) => $_setBytes(0, value);+ @$pb.TagNumber(1)+ $core.bool hasAvatarHash() => $_has(0);+ @$pb.TagNumber(1)+ void clearAvatarHash() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.List<$core.int> get jpeg => $_getN(1);+ @$pb.TagNumber(2)+ set jpeg($core.List<$core.int> value) => $_setBytes(1, value);+ @$pb.TagNumber(2)+ $core.bool hasJpeg() => $_has(1);+ @$pb.TagNumber(2)+ void clearJpeg() => $_clearField(2);}/// 连接就绪后各自发一次,与 LinkInfo 一起;功能开关变了再发一次。@@ -3569,6 +4280,7 @@ class SendOffer extends $pb.GeneratedMessage {$fixnum.Int64? largestFile,$fixnum.Int64? createdAtUnix,$core.bool? resume,+ $core.String? note,}) {final result = SendOffer._();if (transferId != null) result.transferId = transferId;@@ -3579,6 +4291,7 @@ class SendOffer extends $pb.GeneratedMessage {if (largestFile != null) result.largestFile = largestFile;if (createdAtUnix != null) result.createdAtUnix = createdAtUnix;if (resume != null) result.resume = resume;+ if (note != null) result.note = note;return result;}@@ -3604,6 +4317,7 @@ class SendOffer extends $pb.GeneratedMessage {..aInt64(6, _omitFieldNames ? '' : 'largestFile')..aInt64(7, _omitFieldNames ? '' : 'createdAtUnix')..aOB(8, _omitFieldNames ? '' : 'resume')+ ..aOS(9, _omitFieldNames ? '' : 'note')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -3695,6 +4409,16 @@ class SendOffer extends $pb.GeneratedMessage {$core.bool hasResume() => $_has(7);@$pb.TagNumber(8)void clearResume() => $_clearField(8);++ /// 备注(2.6.0):最多 200 个字符、单行,必须附在文件上+ @$pb.TagNumber(9)+ $core.String get note => $_getSZ(8);+ @$pb.TagNumber(9)+ set note($core.String value) => $_setString(8, value);+ @$pb.TagNumber(9)+ $core.bool hasNote() => $_has(8);+ @$pb.TagNumber(9)+ void clearNote() => $_clearField(9);}class SendAnswer extends $pb.GeneratedMessage {diff --git a/ui/lib/gen/pasteferry/v1/wire.pbjson.dart b/ui/lib/gen/pasteferry/v1/wire.pbjson.dartindex 3a56196..8557cce 100644--- a/ui/lib/gen/pasteferry/v1/wire.pbjson.dart+++ b/ui/lib/gen/pasteferry/v1/wire.pbjson.dart@@ -131,6 +131,42 @@ const SignalMessage$json = {'9': 0,'10': 'retryDirect'},+ {+ '1': 'pair_intent',+ '3': 16,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.PairIntent',+ '9': 0,+ '10': 'pairIntent'+ },+ {+ '1': 'friend_confirm',+ '3': 17,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.FriendConfirm',+ '9': 0,+ '10': 'friendConfirm'+ },+ {+ '1': 'stranger_hello',+ '3': 18,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.StrangerHello',+ '9': 0,+ '10': 'strangerHello'+ },+ {+ '1': 'friend_remove',+ '3': 19,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.FriendRemove',+ '9': 0,+ '10': 'friendRemove'+ },],'8': [{'1': 'payload'},@@ -150,7 +186,66 @@ final $typed_data.Uint8List signalMessageDescriptor = $convert.base64Decode('ZGF0ZRIpCgRwaW5nGA0gASgLMhMucGFzdGVmZXJyeS52MS5QaW5nSABSBHBpbmcSNgoJbGFuX2''hlbGxvGA4gASgLMhcucGFzdGVmZXJyeS52MS5MYW5IZWxsb0gAUghsYW5IZWxsbxI/CgxyZXRy''eV9kaXJlY3QYDyABKAsyGi5wYXN0ZWZlcnJ5LnYxLlJldHJ5RGlyZWN0SABSC3JldHJ5RGlyZW'- 'N0QgkKB3BheWxvYWQ=');+ 'N0EjwKC3BhaXJfaW50ZW50GBAgASgLMhkucGFzdGVmZXJyeS52MS5QYWlySW50ZW50SABSCnBh'+ 'aXJJbnRlbnQSRQoOZnJpZW5kX2NvbmZpcm0YESABKAsyHC5wYXN0ZWZlcnJ5LnYxLkZyaWVuZE'+ 'NvbmZpcm1IAFINZnJpZW5kQ29uZmlybRJFCg5zdHJhbmdlcl9oZWxsbxgSIAEoCzIcLnBhc3Rl'+ 'ZmVycnkudjEuU3RyYW5nZXJIZWxsb0gAUg1zdHJhbmdlckhlbGxvEkIKDWZyaWVuZF9yZW1vdm'+ 'UYEyABKAsyGy5wYXN0ZWZlcnJ5LnYxLkZyaWVuZFJlbW92ZUgAUgxmcmllbmRSZW1vdmVCCQoH'+ 'cGF5bG9hZA==');++@$core.Deprecated('Use pairIntentDescriptor instead')+const PairIntent$json = {+ '1': 'PairIntent',+ '2': [+ {'1': 'intent', '3': 1, '4': 1, '5': 9, '10': 'intent'},+ {+ '1': 'card',+ '3': 2,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.FriendCard',+ '10': 'card'+ },+ ],+};++/// Descriptor for `PairIntent`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List pairIntentDescriptor = $convert.base64Decode(+ 'CgpQYWlySW50ZW50EhYKBmludGVudBgBIAEoCVIGaW50ZW50Ei0KBGNhcmQYAiABKAsyGS5wYX'+ 'N0ZWZlcnJ5LnYxLkZyaWVuZENhcmRSBGNhcmQ=');++@$core.Deprecated('Use friendConfirmDescriptor instead')+const FriendConfirm$json = {+ '1': 'FriendConfirm',+ '2': [+ {'1': 'accepted', '3': 1, '4': 1, '5': 8, '10': 'accepted'},+ ],+};++/// Descriptor for `FriendConfirm`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List friendConfirmDescriptor = $convert.base64Decode(+ 'Cg1GcmllbmRDb25maXJtEhoKCGFjY2VwdGVkGAEgASgIUghhY2NlcHRlZA==');++@$core.Deprecated('Use strangerHelloDescriptor instead')+const StrangerHello$json = {+ '1': 'StrangerHello',+ '2': [+ {+ '1': 'card',+ '3': 1,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.FriendCard',+ '10': 'card'+ },+ {'1': 'reply', '3': 2, '4': 1, '5': 8, '10': 'reply'},+ ],+};++/// Descriptor for `StrangerHello`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List strangerHelloDescriptor = $convert.base64Decode(+ 'Cg1TdHJhbmdlckhlbGxvEi0KBGNhcmQYASABKAsyGS5wYXN0ZWZlcnJ5LnYxLkZyaWVuZENhcm'+ 'RSBGNhcmQSFAoFcmVwbHkYAiABKAhSBXJlcGx5');@$core.Deprecated('Use retryDirectDescriptor instead')const RetryDirect$json = {@@ -615,6 +710,15 @@ const LanPacket$json = {'9': 0,'10': 'nearbyPing'},+ {+ '1': 'stranger_request',+ '3': 7,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.LanPairSigned',+ '9': 0,+ '10': 'strangerRequest'+ },],'8': [{'1': 'payload'},@@ -630,7 +734,8 @@ final $typed_data.Uint8List lanPacketDescriptor = $convert.base64Decode('c3RlZmVycnkudjEuTGFuUGFpclJlamVjdEgAUgpwYWlyUmVqZWN0EkUKDm5lYXJieV9yZXF1ZX''N0GAUgASgLMhwucGFzdGVmZXJyeS52MS5MYW5QYWlyU2lnbmVkSABSDW5lYXJieVJlcXVlc3QS''PwoLbmVhcmJ5X3BpbmcYBiABKAsyHC5wYXN0ZWZlcnJ5LnYxLkxhbk5lYXJieVBpbmdIAFIKbm'- 'VhcmJ5UGluZ0IJCgdwYXlsb2Fk');+ 'VhcmJ5UGluZxJJChBzdHJhbmdlcl9yZXF1ZXN0GAcgASgLMhwucGFzdGVmZXJyeS52MS5MYW5Q'+ 'YWlyU2lnbmVkSABSD3N0cmFuZ2VyUmVxdWVzdEIJCgdwYXlsb2Fk');@$core.Deprecated('Use lanHelloDescriptor instead')const LanHello$json = {@@ -676,6 +781,15 @@ const LanPairInfo$json = {{'1': 'timestamp_unix', '3': 7, '4': 1, '5': 3, '10': 'timestampUnix'},{'1': 'nonce', '3': 8, '4': 1, '5': 12, '10': 'nonce'},{'1': 'request_nonce', '3': 9, '4': 1, '5': 12, '10': 'requestNonce'},+ {'1': 'intent', '3': 10, '4': 1, '5': 9, '10': 'intent'},+ {+ '1': 'card',+ '3': 11,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.FriendCard',+ '10': 'card'+ },],};@@ -686,7 +800,8 @@ final $typed_data.Uint8List lanPairInfoDescriptor = $convert.base64Decode('KAlSCHBsYXRmb3JtEh0KCnB1YmxpY19rZXkYBSABKAxSCXB1YmxpY0tleRIcCglhZGRyZXNzZX''MYBiADKAlSCWFkZHJlc3NlcxIlCg50aW1lc3RhbXBfdW5peBgHIAEoA1INdGltZXN0YW1wVW5p''eBIUCgVub25jZRgIIAEoDFIFbm9uY2USIwoNcmVxdWVzdF9ub25jZRgJIAEoDFIMcmVxdWVzdE'- '5vbmNl');+ '5vbmNlEhYKBmludGVudBgKIAEoCVIGaW50ZW50Ei0KBGNhcmQYCyABKAsyGS5wYXN0ZWZlcnJ5'+ 'LnYxLkZyaWVuZENhcmRSBGNhcmQ=');@$core.Deprecated('Use lanPairRejectDescriptor instead')const LanPairReject$json = {@@ -831,6 +946,33 @@ const PeerMessage$json = {'9': 0,'10': 'sendResult'},+ {+ '1': 'friend_card',+ '3': 13,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.FriendCard',+ '9': 0,+ '10': 'friendCard'+ },+ {+ '1': 'avatar_request',+ '3': 14,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.AvatarRequest',+ '9': 0,+ '10': 'avatarRequest'+ },+ {+ '1': 'avatar_data',+ '3': 15,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.AvatarData',+ '9': 0,+ '10': 'avatarData'+ },],'8': [{'1': 'payload'},@@ -851,7 +993,76 @@ final $typed_data.Uint8List peerMessageDescriptor = $convert.base64Decode('tzZW5kX2Fuc3dlchgKIAEoCzIZLnBhc3RlZmVycnkudjEuU2VuZEFuc3dlckgAUgpzZW5kQW5z''d2VyEjwKC3NlbmRfY2FuY2VsGAsgASgLMhkucGFzdGVmZXJyeS52MS5TZW5kQ2FuY2VsSABSCn''NlbmRDYW5jZWwSPAoLc2VuZF9yZXN1bHQYDCABKAsyGS5wYXN0ZWZlcnJ5LnYxLlNlbmRSZXN1'- 'bHRIAFIKc2VuZFJlc3VsdEIJCgdwYXlsb2Fk');+ 'bHRIAFIKc2VuZFJlc3VsdBI8CgtmcmllbmRfY2FyZBgNIAEoCzIZLnBhc3RlZmVycnkudjEuRn'+ 'JpZW5kQ2FyZEgAUgpmcmllbmRDYXJkEkUKDmF2YXRhcl9yZXF1ZXN0GA4gASgLMhwucGFzdGVm'+ 'ZXJyeS52MS5BdmF0YXJSZXF1ZXN0SABSDWF2YXRhclJlcXVlc3QSPAoLYXZhdGFyX2RhdGEYDy'+ 'ABKAsyGS5wYXN0ZWZlcnJ5LnYxLkF2YXRhckRhdGFIAFIKYXZhdGFyRGF0YUIJCgdwYXlsb2Fk');++@$core.Deprecated('Use friendCardDescriptor instead')+const FriendCard$json = {+ '1': 'FriendCard',+ '2': [+ {'1': 'display_name', '3': 1, '4': 1, '5': 9, '10': 'displayName'},+ {'1': 'device_name', '3': 2, '4': 1, '5': 9, '10': 'deviceName'},+ {'1': 'platform', '3': 3, '4': 1, '5': 9, '10': 'platform'},+ {'1': 'service', '3': 4, '4': 1, '5': 9, '10': 'service'},+ {+ '1': 'custom_server_hash',+ '3': 5,+ '4': 1,+ '5': 12,+ '10': 'customServerHash'+ },+ {'1': 'avatar_hash', '3': 6, '4': 1, '5': 12, '10': 'avatarHash'},+ ],+};++/// Descriptor for `FriendCard`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List friendCardDescriptor = $convert.base64Decode(+ 'CgpGcmllbmRDYXJkEiEKDGRpc3BsYXlfbmFtZRgBIAEoCVILZGlzcGxheU5hbWUSHwoLZGV2aW'+ 'NlX25hbWUYAiABKAlSCmRldmljZU5hbWUSGgoIcGxhdGZvcm0YAyABKAlSCHBsYXRmb3JtEhgK'+ 'B3NlcnZpY2UYBCABKAlSB3NlcnZpY2USLAoSY3VzdG9tX3NlcnZlcl9oYXNoGAUgASgMUhBjdX'+ 'N0b21TZXJ2ZXJIYXNoEh8KC2F2YXRhcl9oYXNoGAYgASgMUgphdmF0YXJIYXNo');++@$core.Deprecated('Use friendRemoveDescriptor instead')+const FriendRemove$json = {+ '1': 'FriendRemove',+ '2': [+ {'1': 'at_unix', '3': 1, '4': 1, '5': 3, '10': 'atUnix'},+ {'1': 'ack', '3': 2, '4': 1, '5': 8, '10': 'ack'},+ ],+};++/// Descriptor for `FriendRemove`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List friendRemoveDescriptor = $convert.base64Decode(+ 'CgxGcmllbmRSZW1vdmUSFwoHYXRfdW5peBgBIAEoA1IGYXRVbml4EhAKA2FjaxgCIAEoCFIDYW'+ 'Nr');++@$core.Deprecated('Use avatarRequestDescriptor instead')+const AvatarRequest$json = {+ '1': 'AvatarRequest',+ '2': [+ {'1': 'avatar_hash', '3': 1, '4': 1, '5': 12, '10': 'avatarHash'},+ ],+};++/// Descriptor for `AvatarRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List avatarRequestDescriptor = $convert.base64Decode(+ 'Cg1BdmF0YXJSZXF1ZXN0Eh8KC2F2YXRhcl9oYXNoGAEgASgMUgphdmF0YXJIYXNo');++@$core.Deprecated('Use avatarDataDescriptor instead')+const AvatarData$json = {+ '1': 'AvatarData',+ '2': [+ {'1': 'avatar_hash', '3': 1, '4': 1, '5': 12, '10': 'avatarHash'},+ {'1': 'jpeg', '3': 2, '4': 1, '5': 12, '10': 'jpeg'},+ ],+};++/// Descriptor for `AvatarData`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List avatarDataDescriptor = $convert.base64Decode(+ 'CgpBdmF0YXJEYXRhEh8KC2F2YXRhcl9oYXNoGAEgASgMUgphdmF0YXJIYXNoEhIKBGpwZWcYAi'+ 'ABKAxSBGpwZWc=');@$core.Deprecated('Use peerFeaturesDescriptor instead')const PeerFeatures$json = {@@ -1028,6 +1239,7 @@ const SendOffer$json = {{'1': 'largest_file', '3': 6, '4': 1, '5': 3, '10': 'largestFile'},{'1': 'created_at_unix', '3': 7, '4': 1, '5': 3, '10': 'createdAtUnix'},{'1': 'resume', '3': 8, '4': 1, '5': 8, '10': 'resume'},+ {'1': 'note', '3': 9, '4': 1, '5': 9, '10': 'note'},],};@@ -1038,7 +1250,7 @@ final $typed_data.Uint8List sendOfferDescriptor = $convert.base64Decode('BWl0ZW1zEh8KC3RvdGFsX2J5dGVzGAQgASgDUgp0b3RhbEJ5dGVzEh0KCmZpbGVfY291bnQYBS''ABKANSCWZpbGVDb3VudBIhCgxsYXJnZXN0X2ZpbGUYBiABKANSC2xhcmdlc3RGaWxlEiYKD2Ny''ZWF0ZWRfYXRfdW5peBgHIAEoA1INY3JlYXRlZEF0VW5peBIWCgZyZXN1bWUYCCABKAhSBnJlc3'- 'VtZQ==');+ 'VtZRISCgRub3RlGAkgASgJUgRub3Rl');@$core.Deprecated('Use sendAnswerDescriptor instead')const SendAnswer$json = {