(path string, size int64, digest string)
| 229 | } |
| 230 | |
| 231 | func shadowPluginMatches(path string, size int64, digest string) bool { |
| 232 | info, errStat := os.Stat(path) |
| 233 | if errStat != nil { |
| 234 | return false |
| 235 | } |
| 236 | if !info.Mode().IsRegular() || info.Size() != size { |
| 237 | return false |
| 238 | } |
| 239 | file, errOpen := os.Open(path) |
| 240 | if errOpen != nil { |
| 241 | return false |
| 242 | } |
| 243 | defer func() { |
| 244 | _ = file.Close() |
| 245 | }() |
| 246 | hasher := sha256.New() |
| 247 | if _, errCopy := io.Copy(hasher, file); errCopy != nil { |
| 248 | return false |
| 249 | } |
| 250 | return hex.EncodeToString(hasher.Sum(nil)) == digest |
| 251 | } |
| 252 | |
| 253 | func (c *dynamicLibraryClient) Call(ctx context.Context, method string, request []byte) ([]byte, error) { |
| 254 | if c == nil || c.api.call == 0 { |
no test coverage detected