(msg proto.Message)
| 1104 | } |
| 1105 | |
| 1106 | func messageContext(msg proto.Message) (string, error) { |
| 1107 | switch msg := msg.(type) { |
| 1108 | case *bep.ClusterConfig: |
| 1109 | return "cluster-config", nil |
| 1110 | case *bep.Index: |
| 1111 | return fmt.Sprintf("index for %v", msg.Folder), nil |
| 1112 | case *bep.IndexUpdate: |
| 1113 | return fmt.Sprintf("index-update for %v", msg.Folder), nil |
| 1114 | case *bep.Request: |
| 1115 | return fmt.Sprintf(`request for "%v" in %v`, msg.Name, msg.Folder), nil |
| 1116 | case *bep.Response: |
| 1117 | return "response", nil |
| 1118 | case *bep.DownloadProgress: |
| 1119 | return fmt.Sprintf("download-progress for %v", msg.Folder), nil |
| 1120 | case *bep.Ping: |
| 1121 | return "ping", nil |
| 1122 | case *bep.Close: |
| 1123 | return "close", nil |
| 1124 | default: |
| 1125 | return "", errors.New("unknown or empty message") |
| 1126 | } |
| 1127 | } |
| 1128 | |
| 1129 | // connectionWrappingModel takes the Model interface from the model package, |
| 1130 | // which expects the Connection as the first parameter in all methods, and |
no test coverage detected