$| \int fg|\leq 1$ for any $g\in C_{0}^{\infty}$, $\|g\|_{L^{2}}=1$ then $\|f\|_{L^{2}}\leq1$

Consider that \begin{align*} T_{f}:C_{0}^{\infty}\rightarrow\mathbb{C},~~~~g\rightarrow\int fg, \end{align*} then by assumption $\|T_{f}(g)\|\leq\|g\|_{L^{2}}$ and hence $\|T_{f}\|\leq 1$. But $C_{0}^{\infty}$ is dense in $L^{2}$, so there is a unique extension $\overline{T}\in(L^{2})^{\ast}$ of $T_{f}$ such that $\left\|\overline{T}\right\|=\|T_{f}\|$. By Riesz Representation Theorem, we have $(L^{2})^{\ast}=L^{2}$ in the sense that a unique $h\in L^{2}$ is such that \begin{align*} \overline{T}(g)=\int hg,~~~~g\in L^{2}, \end{align*} and that $\|h\|_{L^{2}}=\left\|\overline{T}\right\|$. It follows that $\|h\|_{L^{2}}\leq 1$ and that \begin{align*} \int(h-f)g=0,~~~~g\in C_{0}^{\infty}. \end{align*} If it were shown to be the case that $h-f=0$ a.e. then we are done.

So the matter is now to show that $\displaystyle\int fg=0$ for all $g\in C_{0}^{\infty}$ will imply that $f=0$ a.e.

First note that the existence of $\displaystyle\int fg$ entails that $\displaystyle\int|fg|<\infty$. For a fixed compact set $K$, take a nonnegative $g\in C_{0}^{\infty}$ such that $g=1$ on $K$, then $\displaystyle\int|fg|\geq\int_{K}|f|$, then $f\in L^{1}(K)$.

On the other hand, for a fixed $x$, we have $\displaystyle\int f(\cdot)\varphi_{\epsilon}(x-\cdot)=0$, where $\varphi_{\epsilon}$ is a standard nonnegative mollifier, the equation is no more than saying that $\varphi_{\epsilon}\ast f(x)=0$. As $\varphi_{\epsilon}\ast f\rightarrow f$ in $L^{1}(K)$, we have $f=0$ a.e. on $K$.

The result follows by considering an exhaustion of compact sets to the whole space.