| 508 | } |
| 509 | |
| 510 | func importEndpointTLS(tlsData *ContextTLSData, tlsPath string, data []byte) error { |
| 511 | parts := strings.SplitN(strings.TrimPrefix(tlsPath, "tls/"), "/", 2) |
| 512 | if len(parts) != 2 { |
| 513 | // TLS endpoints require archived file directory with 2 layers |
| 514 | // i.e. tls/{endpointName}/{fileName} |
| 515 | return errors.New("archive format is invalid") |
| 516 | } |
| 517 | |
| 518 | epName := parts[0] |
| 519 | fileName := parts[1] |
| 520 | if _, ok := tlsData.Endpoints[epName]; !ok { |
| 521 | tlsData.Endpoints[epName] = EndpointTLSData{ |
| 522 | Files: map[string][]byte{}, |
| 523 | } |
| 524 | } |
| 525 | tlsData.Endpoints[epName].Files[fileName] = data |
| 526 | return nil |
| 527 | } |
| 528 | |
| 529 | type contextdir string |
| 530 | |