Application of nanostructures for THz generation and detection enhancement