Reconfigurable Intelligent Surface Assisted Two–Way Communications: Performance Analysis and Optimization